forked from TrueCloudLab/neoneo-go
new mapping for interop api (CityOfZion/neo-storm#10)
* new mapping for interop api * Fixed interop API mapping + added missing apis * added engine apis Imported from CityOfZion/neo-storm (ec5e6c8e2b587704a1e071e83b633d2d3a235300).
This commit is contained in:
parent
2fbb269c0d
commit
0b33cf3193
7 changed files with 181 additions and 83 deletions
|
@ -185,7 +185,7 @@ func (c *codegen) convertFuncDecl(file ast.Node, decl *ast.FuncDecl) {
|
|||
}
|
||||
// Load in all the global variables in to the scope of the function.
|
||||
// This is not necessary for syscalls.
|
||||
if !isSyscall(f.name) {
|
||||
if !isSyscall(f) {
|
||||
c.convertGlobals(file)
|
||||
}
|
||||
|
||||
|
@ -394,7 +394,10 @@ func (c *codegen) Visit(node ast.Node) ast.Visitor {
|
|||
// Dont forget to add 1 extra argument when its a method.
|
||||
numArgs++
|
||||
}
|
||||
|
||||
f, ok = c.funcs[fun.Sel.Name]
|
||||
// @FIXME this could cause runtime errors.
|
||||
f.selector = fun.X.(*ast.Ident)
|
||||
if !ok {
|
||||
log.Fatalf("could not resolve function %s", fun.Sel.Name)
|
||||
}
|
||||
|
@ -433,8 +436,8 @@ func (c *codegen) Visit(node ast.Node) ast.Visitor {
|
|||
// Use the ident to check, builtins are not in func scopes.
|
||||
// We can be sure builtins are of type *ast.Ident.
|
||||
c.convertBuiltin(n)
|
||||
case isSyscall(f.name):
|
||||
c.convertSyscall(f.name)
|
||||
case isSyscall(f):
|
||||
c.convertSyscall(f.selector.Name, f.name)
|
||||
default:
|
||||
emitCall(c.prog, vm.CALL, int16(f.label))
|
||||
}
|
||||
|
@ -531,8 +534,8 @@ func (c *codegen) Visit(node ast.Node) ast.Visitor {
|
|||
return c
|
||||
}
|
||||
|
||||
func (c *codegen) convertSyscall(name string) {
|
||||
api, ok := syscalls[name]
|
||||
func (c *codegen) convertSyscall(api, name string) {
|
||||
api, ok := syscalls[api][name]
|
||||
if !ok {
|
||||
log.Fatalf("unknown VM syscall api: %s", name)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue