Permalink
Browse files

less magic js.MakeFunc

  • Loading branch information...
1 parent d9e19eb commit 621f92032902efdbc078c3627f034bb7615a0e94 @neelance neelance committed May 22, 2016
Showing with 2 additions and 4 deletions.
  1. +0 −2 compiler/expressions.go
  2. +2 −2 js/js.go
@@ -566,8 +566,6 @@ func (c *funcContext) translateExpr(expr ast.Expr) *expression {
return c.formatExpr("debugger")
case "InternalObject":
return c.translateExpr(e.Args[0])
- case "MakeFunc":
- return c.formatExpr("$makeFunc(%e)", e.Args[0])
}
}
return c.translateCall(e, sig, c.translateExpr(f))
View
@@ -112,8 +112,8 @@ func InternalObject(i interface{}) *Object {
}
// MakeFunc wraps a function and gives access to the values of JavaScript's "this" and "arguments" keywords.
-func MakeFunc(func(this *Object, arguments []*Object) interface{}) *Object {
- return nil
+func MakeFunc(fn func(this *Object, arguments []*Object) interface{}) *Object {
+ return Global.Call("$makeFunc", InternalObject(fn))
}
// Keys returns the keys of the given JavaScript object.

0 comments on commit 621f920

Please sign in to comment.