浏览代码

use new JsInterp for formulas

Nicolas Cannasse 11 月之前
父节点
当前提交
e62c671c3b
共有 1 个文件被更改,包括 5 次插入3 次删除
  1. 5 3
      hide/comp/cdb/Formulas.hx

+ 5 - 3
hide/comp/cdb/Formulas.hx

@@ -186,10 +186,12 @@ class Formulas {
 
 		formulas = [];
 		fmap = new Map();
-		var interp = new hscript.Interp();
-		interp.variables.set("Math", Math);
+		var o : Dynamic = { Math : Math };
 		for( r in refs )
-			interp.variables.set(r.name, r);
+			Reflect.setField(o,r.name, r);
+		var interp = new hscript.JsInterp();
+		interp.ctx = o;
+		interp.properties = ["all" => true];
 
 		try interp.execute(expr) catch( e : hscript.Expr.Error ) {
 			ide.error(formulasFile+": "+e.toString());