public dynamic Invoke(ScriptExecutionContext context, params dynamic[] args) { if (this.defaults != null && args.Length < this.defaults.Length) { dynamic[] newArgs = new dynamic[this.defaults.Length]; for (int i = 0; i < args.Length; i++) { newArgs[i] = args[i]; } for (int i = args.Length; i < this.defaults.Length; i++) { newArgs[i] = this.defaults[i]; } args = newArgs; } object[] invokeArgs = new object[args.Length + 2]; invokeArgs[0] = context; invokeArgs[1] = this.captures; for (int i = 0; i < args.Length; i++) invokeArgs[i + 2] = args[i]; return this.func.DynamicInvoke(invokeArgs); }
public ScriptEngine() { this.lexer = new ScriptLexer(); this.parser = new ScriptParser(); this.codeGenerator = new CodeGenerator(); this.codeCompiler = new CodeCompiler(); this.executionContext = new ScriptExecutionContext(); }