Skip to content

Commit c59253e

Browse files
Replacing eval() calls in syscall/js
1 parent beff8ba commit c59253e

File tree

1 file changed

+4
-4
lines changed
  • compiler/natives/src/syscall/js

1 file changed

+4
-4
lines changed

compiler/natives/src/syscall/js/js.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,9 @@ var (
117117

118118
func init() {
119119
if js.Global != nil {
120-
id = js.Global.Call("eval", "(function(x) { return x; })")
121-
instanceOf = js.Global.Call("eval", "(function(x, y) { return x instanceof y; })")
122-
getValueType = js.Global.Call("eval", `(function(x) {
120+
id = js.Global.Call("Function", "x", "return x")
121+
instanceOf = js.Global.Call("Function", "x", "y", "return x instanceof y")
122+
getValueType = js.Global.Call("Function", "x", `
123123
if (typeof(x) === "undefined") {
124124
return 0; // TypeUndefined
125125
}
@@ -142,7 +142,7 @@ func init() {
142142
return 7; // TypeFunction
143143
}
144144
return 6; // TypeObject
145-
})`)
145+
`)
146146
}
147147
}
148148

0 commit comments

Comments
 (0)