forked from TrueCloudLab/neoneo-go
compiler: drop useless options parameter to Compile()
It's not used in any way there.
This commit is contained in:
parent
e319c6c638
commit
579aa31ddd
5 changed files with 6 additions and 10 deletions
|
@ -266,7 +266,7 @@ func inspect(ctx *cli.Context) error {
|
||||||
return cli.NewExitError(err, 1)
|
return cli.NewExitError(err, 1)
|
||||||
}
|
}
|
||||||
if compile {
|
if compile {
|
||||||
b, err = compiler.Compile(bytes.NewReader(b), &compiler.Options{})
|
b, err = compiler.Compile(bytes.NewReader(b))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return cli.NewExitError(errors.Wrap(err, "failed to compile"), 1)
|
return cli.NewExitError(errors.Wrap(err, "failed to compile"), 1)
|
||||||
}
|
}
|
||||||
|
|
|
@ -259,7 +259,7 @@ func handleLoadGo(c *ishell.Context) {
|
||||||
c.Err(err)
|
c.Err(err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
b, err := compiler.Compile(bytes.NewReader(fb), &compiler.Options{})
|
b, err := compiler.Compile(bytes.NewReader(fb))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.Err(err)
|
c.Err(err)
|
||||||
return
|
return
|
||||||
|
|
|
@ -37,7 +37,7 @@ type buildInfo struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compile compiles a Go program into bytecode that can run on the NEO virtual machine.
|
// 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}
|
conf := loader.Config{ParserMode: parser.ParseComments}
|
||||||
f, err := conf.ParseFile("", r)
|
f, err := conf.ParseFile("", r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -84,7 +84,7 @@ func CompileAndSave(src string, o *Options) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
b, err = Compile(bytes.NewReader(b), o)
|
b, err = Compile(bytes.NewReader(b))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("error while trying to compile smart contract file: %v", err)
|
return fmt.Errorf("error while trying to compile smart contract file: %v", err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,14 +44,10 @@ func filterFilename(infos []os.FileInfo) string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func compileFile(src string) error {
|
func compileFile(src string) error {
|
||||||
o := compiler.Options{
|
|
||||||
Outfile: "tmp/contract.avm",
|
|
||||||
}
|
|
||||||
|
|
||||||
file, err := os.Open(src)
|
file, err := os.Open(src)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
_, err = compiler.Compile(file, &o)
|
_, err = compiler.Compile(file)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.Put", storePlugin.Put, 1)
|
||||||
vm.RegisterInteropFunc("Neo.Storage.GetContext", storePlugin.GetContext, 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 {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue