public static Object JScriptEvaluate(Object source, VsaEngine engine){ if (Convert.GetTypeCode(source) != TypeCode.String) return source; if (engine.doFast) engine.PushScriptObject(new BlockScope(engine.ScriptObjectStackTop())); try{ Context context = new Context(new DocumentContext("eval code", engine), ((IConvertible)source).ToString()); JSParser p = new JSParser(context); return ((Completion)p.ParseEvalBody().PartiallyEvaluate().Evaluate()).value; }finally{ if (engine.doFast) engine.PopScriptObject(); } }
private static Object DoEvaluate(Object source, VsaEngine engine, bool isUnsafe) { if (engine.doFast) { engine.PushScriptObject(new BlockScope(engine.ScriptObjectStackTop())); } try{ Context context = new Context(new DocumentContext("eval code", engine), ((IConvertible)source).ToString()); JSParser p = new JSParser(context); if (!isUnsafe) { new SecurityPermission(SecurityPermissionFlag.Execution).PermitOnly(); } return(((Completion)p.ParseEvalBody().PartiallyEvaluate().Evaluate()).value); }finally{ if (engine.doFast) { engine.PopScriptObject(); } } }
public static Object JScriptEvaluate(Object source, VsaEngine engine) { if (Convert.GetTypeCode(source) != TypeCode.String) { return(source); } if (engine.doFast) { engine.PushScriptObject(new BlockScope(engine.ScriptObjectStackTop())); } try{ Context context = new Context(new DocumentContext("eval code", engine), ((IConvertible)source).ToString()); JSParser p = new JSParser(context); return(((Completion)p.ParseEvalBody().PartiallyEvaluate().Evaluate()).value); }finally{ if (engine.doFast) { engine.PopScriptObject(); } } }
private static object DoEvaluate(object source, VsaEngine engine, bool isUnsafe) { object obj2; if (engine.doFast) { engine.PushScriptObject(new BlockScope(engine.ScriptObjectStackTop())); } try { Context context = new Context(new DocumentContext("eval code", engine), ((IConvertible) source).ToString()); JSParser parser = new JSParser(context); obj2 = ((Completion) parser.ParseEvalBody().PartiallyEvaluate().Evaluate()).value; } finally { if (engine.doFast) { engine.PopScriptObject(); } } return obj2; }
private static object DoEvaluate(object source, VsaEngine engine, bool isUnsafe) { object obj2; if (engine.doFast) { engine.PushScriptObject(new BlockScope(engine.ScriptObjectStackTop())); } try { Context context = new Context(new DocumentContext("eval code", engine), ((IConvertible)source).ToString()); JSParser parser = new JSParser(context); obj2 = ((Completion)parser.ParseEvalBody().PartiallyEvaluate().Evaluate()).value; } finally { if (engine.doFast) { engine.PopScriptObject(); } } return(obj2); }
private static Object DoEvaluate(Object source, VsaEngine engine, bool isUnsafe){ if (engine.doFast) engine.PushScriptObject(new BlockScope(engine.ScriptObjectStackTop())); try{ Context context = new Context(new DocumentContext("eval code", engine), ((IConvertible)source).ToString()); JSParser p = new JSParser(context); if (!isUnsafe) new SecurityPermission(SecurityPermissionFlag.Execution).PermitOnly(); return ((Completion)p.ParseEvalBody().PartiallyEvaluate().Evaluate()).value; }finally{ if (engine.doFast) engine.PopScriptObject(); } }