aboutsummaryrefslogtreecommitdiffstats
path: root/jsre/jsre.go
diff options
context:
space:
mode:
Diffstat (limited to 'jsre/jsre.go')
-rw-r--r--jsre/jsre.go12
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
+}