diff options
author | obscuren <geffobscura@gmail.com> | 2015-03-25 00:49:28 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-03-25 00:49:28 +0800 |
commit | c38a3b4cc7b7dc62c7fca9cd46a880b036462a27 (patch) | |
tree | b82bb1eb9e7bb7a9eeefe152979ea67ef62b2394 /jsre/jsre.go | |
parent | 9de1ad65460898ab79c02ce076f1a2b0a7144656 (diff) | |
download | dexon-c38a3b4cc7b7dc62c7fca9cd46a880b036462a27.tar.gz dexon-c38a3b4cc7b7dc62c7fca9cd46a880b036462a27.tar.zst dexon-c38a3b4cc7b7dc62c7fca9cd46a880b036462a27.zip |
Better error reporting in the console. Updated ethereum.js
Diffstat (limited to 'jsre/jsre.go')
-rw-r--r-- | jsre/jsre.go | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/jsre/jsre.go b/jsre/jsre.go index a01fb56d8..a49422a12 100644 --- a/jsre/jsre.go +++ b/jsre/jsre.go @@ -2,9 +2,10 @@ package jsre import ( "fmt" - "github.com/robertkrimen/otto" "io/ioutil" + "github.com/robertkrimen/otto" + "github.com/ethereum/go-ethereum/common" ) @@ -113,3 +114,12 @@ func (self *JSRE) Eval(code string) (s string, err error) { } return fmt.Sprintf("%v", val), nil } + +func (self *JSRE) Compile(fn string, src interface{}) error { + script, err := self.vm.Compile(fn, src) + if err != nil { + return err + } + self.vm.Run(script) + return nil +} |