compiler: drop useless options parameter to Compile()

It's not used in any way there.
This commit is contained in:
Roman Khimov 2019-10-29 13:02:54 +03:00
parent e319c6c638
commit 579aa31ddd
5 changed files with 6 additions and 10 deletions

View file

@ -266,7 +266,7 @@ func inspect(ctx *cli.Context) error {
return cli.NewExitError(err, 1)
}
if compile {
b, err = compiler.Compile(bytes.NewReader(b), &compiler.Options{})
b, err = compiler.Compile(bytes.NewReader(b))
if err != nil {
return cli.NewExitError(errors.Wrap(err, "failed to compile"), 1)
}

View file

@ -259,7 +259,7 @@ func handleLoadGo(c *ishell.Context) {
c.Err(err)
return
}
b, err := compiler.Compile(bytes.NewReader(fb), &compiler.Options{})
b, err := compiler.Compile(bytes.NewReader(fb))
if err != nil {
c.Err(err)
return

View file

@ -37,7 +37,7 @@ type buildInfo struct {
}
// Compile compiles a Go program into bytecode that can run on the NEO virtual machine.
func Compile(r io.Reader, o *Options) ([]byte, error) {
func Compile(r io.Reader) ([]byte, error) {
conf := loader.Config{ParserMode: parser.ParseComments}
f, err := conf.ParseFile("", r)
if err != nil {
@ -84,7 +84,7 @@ func CompileAndSave(src string, o *Options) error {
if err != nil {
return err
}
b, err = Compile(bytes.NewReader(b), o)
b, err = Compile(bytes.NewReader(b))
if err != nil {
return fmt.Errorf("error while trying to compile smart contract file: %v", err)
}

View file

@ -44,14 +44,10 @@ func filterFilename(infos []os.FileInfo) string {
}
func compileFile(src string) error {
o := compiler.Options{
Outfile: "tmp/contract.avm",
}
file, err := os.Open(src)
if err != nil {
return err
}
_, err = compiler.Compile(file, &o)
_, err = compiler.Compile(file)
return err
}

View file

@ -52,7 +52,7 @@ func vmAndCompile(t *testing.T, src string) *vm.VM {
vm.RegisterInteropFunc("Neo.Storage.Put", storePlugin.Put, 1)
vm.RegisterInteropFunc("Neo.Storage.GetContext", storePlugin.GetContext, 1)
b, err := compiler.Compile(strings.NewReader(src), &compiler.Options{})
b, err := compiler.Compile(strings.NewReader(src))
if err != nil {
t.Fatal(err)
}