public override void Evaluate(IScriptContext context) { bool condBool; object result = RuntimeHost.NullValue; init.Evaluate(context); cond.Evaluate(context); condBool = context.Result == null ? true : (bool)context.Result; while (condBool) { statement.Evaluate(context); result = context.Result; if (context.IsBreak() || context.IsReturn()) { context.SetBreak(false); break; } if (context.IsContinue()) { context.SetContinue(false); } next.Evaluate(context); cond.Evaluate(context); condBool = context.Result == null ? true : (bool)context.Result; } context.Result = result; }
public override void Evaluate(IScriptContext context) { context.SetItem("Context", context); context.SetItem("prog", this); base.Evaluate(context); }
public static void TryRegisterService <TService>(this IScriptContext context, string name) { if (context.Container.TryResolve(null, out TService service)) { context.SetGlobalVariable(name, service); } }
public object Invoke(IScriptContext context, object[] args) { context.CreateScope(); context.SetItem("me", scriptable.Instance); context.SetItem("body", scriptable); object rez = RuntimeHost.NullValue; try { rez = dynamicMethod.Invoke(context, arguments); } finally { context.RemoveLocalScope(); } if (rez != RuntimeHost.NullValue) { return(rez); } else { throw new ScriptException(string.Format("Dynamic method call failed in object {0}", scriptable.ToString())); } }
//TODO: reorganize switch public override void Evaluate(IScriptContext context) { switch (operation) { case "break": if (context.Result == null) { context.Result = RuntimeHost.NullValue; } context.SetBreak(true); break; case "continue": if (context.Result == null) { context.Result = RuntimeHost.NullValue; } context.SetContinue(true); break; case "return": expression.Evaluate(context); context.SetReturn(true); break; case "throw": expression.Evaluate(context); throw (Exception)context.Result; default: throw new ScriptException("This should never happen"); } }
private async Task PerformCallback( HttpContext httpContext, IMockacoContext mockacoContext, IScriptContext scriptContext, ITemplateTransformer templateTransformer, MockacoOptions options) { try { var stopwatch = Stopwatch.StartNew(); var callbackTemplate = await PrepareCallbackTemplate(mockacoContext, scriptContext, templateTransformer); var request = PrepareHttpRequest(callbackTemplate, options); var httpClient = PrepareHttpClient(httpContext, callbackTemplate); await DelayRequest(callbackTemplate, stopwatch.ElapsedMilliseconds); stopwatch.Restart(); _logger.LogDebug("Callback started"); await PerformRequest(request, httpClient); _logger.LogDebug("Callback finished in {0} ms", stopwatch.ElapsedMilliseconds); } catch (Exception ex) { _logger.LogError(ex, "Callback error"); } }
public override void Evaluate(IScriptContext context) { if (_typeExpr == null && _genericsPostfix == null) { context.Result = RuntimeHost.GetType(_identifier); return; } if (_typeExpr != null) { var name = string.Format("{0}.{1}", EvaluateName(_typeExpr), _identifier); Type type; if (_genericsPostfix != null) { var genericType = RuntimeHost.GetType(_genericsPostfix.GetGenericTypeName(name)); _genericsPostfix.Evaluate(context); type = genericType.MakeGenericType((Type[])context.Result); } else { type = RuntimeHost.GetType(name); } context.Result = type; } else { Type genericType = RuntimeHost.GetType(_identifier); _genericsPostfix.Evaluate(context); context.Result = genericType.MakeGenericType((Type[])context.Result); } }
public override void Evaluate(IScriptContext context) { _expr.Evaluate(context); var handler = OnHandleOperator(this, context, OperationSymbol, context.Result); context.Result = handler.Cancel ? handler.Result : RuntimeHost.GetUnaryOperator(OperationSymbol).Evaluate(context.Result); }
public override void Evaluate(IScriptContext context) { Condition.Evaluate(context); object lastResult = RuntimeHost.NullValue; while ((bool)context.Result) { Statement.Evaluate(context); lastResult = context.Result; if (context.IsBreak() || context.IsReturn()) { context.SetBreak(false); break; } if (context.IsContinue()) { context.SetContinue(false); } Condition.Evaluate(context); } context.Result = lastResult; }
public override void Evaluate(IScriptContext context) { if (Parameters != null) { context.Result = Parameters.Identifiers.ToArray(); } }
public override void LoadPlugins() { if (!Directory.Exists(WorkingDirectory)) { Directory.CreateDirectory(WorkingDirectory); } foreach (var directory in Directory.GetDirectories(WorkingDirectory)) { var pluginFile = Path.Combine(directory, "plugin.json"); if (!File.Exists(pluginFile)) { continue; } var meta = GetPluginMeta(directory); var entryFile = Path.Combine(directory, meta.EntryFile); if (!File.Exists(entryFile)) { throw new FileNotFoundException(null, entryFile); } IScriptContext context = null; try { ExecuteFile(entryFile, Container, ref context, meta, true); } catch (Exception ex) { Container.Resolve <ILogger>().LogFatal("Failed to load script: " + meta.Name, ex); } } }
public PyProcessContext(IScriptContext scriptContext, dynamic processHandler, ProcessFactory processFactory, string command, string commandArguments, string workingDirectory, ICommandParameters commandParameters) { _commandParameters = commandParameters; _scriptContext = scriptContext; _command = command; _commandArguments = commandArguments; _workingDirectory = workingDirectory; _processFactory = processFactory; var processContext = _processFactory.CreateProcessContext(command, commandArguments, workingDirectory); _processHandler = processHandler; processContext.OnMessage += (message) => { _processHandler.OnMessage(message); // Console.WriteLine(message); }; processContext.OnError += (message) => { _processHandler.OnError(message); }; _processHandler.OnInit(this, _commandParameters); _processContext = processContext; }
public bool ExecuteExpecting <T>(IScriptContext context, out T result) where T : struct { result = default(T); if (type == SymbolType.Void) { Debug.LogError($"Executable.ExecuteExpecting : cannot expect {typeof(T)}. " + "Use Execute() or ExecuteExpectingArray() instead."); return(false); } ISymbol lastResult = Execute(context); if (lastResult == null || lastResult.Type() != type) { Debug.LogError("Executable.ExecuteExpecting : execution error."); return(false); } if (!TypeCompatibility <T>(lastResult.Type(), lastResult.ArrayType())) { Debug.LogError($"Executable.ExecuteExpecting : result type {typeof(T)} " + $"imcompatible with executable type {type}."); return(false); } Symbol <T> lastResultTyped = lastResult as Symbol <T>; Assert.IsNotNull(lastResultTyped); result = lastResultTyped.Value; return(true); }
public override void Evaluate(IScriptContext context) { bool result = true; if (_list == null) { context.Result = true; return; } _list.Evaluate(context); var rez = (object[])context.Result; foreach (var o in rez) { try { result = result & (bool)o; } catch { throw new ScriptVerificationException(Strings.VerificationNonBoolean); } } context.Result = result; }
public override void Evaluate(IScriptContext context) { // ( Expr ) if (typeExpr == null) { expr.Evaluate(context); } // (Type) Expr else { typeExpr.Evaluate(context); Type type = context.Result as Type; if (type == null) { //NOTE: Handling special case of unary minus operator: // (3+2)-2; ScriptUnaryExpr unary = expr as ScriptUnaryExpr; if (unary == null || unary.OperationSymbol != "-") { throw new ScriptException("Wrong type expression!"); } //NOTE: expr + (unary expr) object left = context.Result; unary.Evaluate(context); context.Result = @operator.Evaluate(left, context.Result); return; } expr.Evaluate(context); context.Result = RuntimeHost.Binder.ConvertTo(context.Result, type); } }
public override void Evaluate(IScriptContext context) { bool result = true; if (list == null) { context.Result = true; return; } list.Evaluate(context); object[] rez = (object[])context.Result; foreach (object o in rez) { try { result = result & (bool)o; } catch { throw new ScriptException("Non boolean expression in post condition"); } } context.Result = result; }
public object Invoke(IScriptContext context, object[] args) { string code = (String)args[0]; ScriptAst result = null; LanguageCompiler compiler = (LanguageCompiler)context.GetItem("Compiler", true); RuntimeHost.Lock(); try { result = Script.Parse(code + ";", false) as ScriptAst; //TODO: Create LocalOnlyScope that can't change Parent's variables //No, need for doing these. It is already done context.CreateScope(); } finally { RuntimeHost.UnLock(); } result.Evaluate(context); context.RemoveLocalScope(); return(context.Result); }
public override void Evaluate(IScriptContext context) { constrExpr.Evaluate(context); IObjectBind call = (IObjectBind)context.Result; context.Result = RuntimeHost.Activator.CreateInstance(context, call); }
public object Invoke(IScriptContext context, object[] args) { var functionScope = (INotifyingScope)RuntimeHost.ScopeFactory.Create(ScopeTypes.Function, context.Scope, context); context.CreateScope(functionScope); Expando values=args.FirstOrDefault() as Expando; if (values != null) { foreach (var field in values.Fields) { context.SetItem(field, values[field]); } } else { if (args.Length > 0) throw new ScriptExecutionException("Wrong type of arguments passed to Program Invokation"); } try { Evaluate(context); } finally { context.RemoveLocalScope(); context.ResetControlFlags(); } return context.Result; }
//TODO: reorganize switch public override void Evaluate(IScriptContext context) { switch (operation) { case "break": if (context.Result == null) context.Result = RuntimeHost.NullValue; context.SetBreak(true); break; case "continue": if (context.Result == null) context.Result = RuntimeHost.NullValue; context.SetContinue(true); break; case "return": expression.Evaluate(context); context.SetReturn(true); break; case "throw": expression.Evaluate(context); throw (Exception)context.Result; default: throw new ScriptException("This should never happen"); } }
public object Invoke(IScriptContext context, object[] args) { context.CreateScope(); context.SetItem("me", scriptable.Instance); context.SetItem("body", scriptable); object rez = RuntimeHost.NullValue; try { rez = dynamicMethod.Invoke(context, arguments); } finally { context.RemoveLocalScope(); } if (rez != RuntimeHost.NullValue) { return rez; } else { throw new ScriptException(string.Format("Dynamic method call failed in object {0}", scriptable.ToString())); } }
public void CheckInv(IScriptContext context) { if (!CheckCondition(inv, context)) { throw new ScriptVerificationException("Invariant for function call failed"); } }
private void EvaluateFunctionCall(IScriptContext context) { EvaluateIdentifier(context); foreach (var node in _modifiers) { var funcCall = node as ScriptFunctionCall; if (funcCall != null) { var function = context.Result as IInvokable; if (function == null) { throw new ScriptExecutionException(string.Format(Strings.ObjectDoesNotImplementIInvokable, Code(context), node.Code(context), Span.Start.Line, Span.Start.Position)); } context.Result = CallFunction(function, funcCall, context); continue; } var arrayResolution = node as ScriptArrayResolution; if (arrayResolution != null) { GetArrayValue(context.Result, arrayResolution, context); continue; } var genericPostfix = node as ScriptGenericsPostfix; if (genericPostfix != null) { throw new NotSupportedException(); //genericPostfix.Evaluate(Context); //continue; } } }
private void AssignArray(object value, IScriptContext context) { var obj = context.GetItem(_identifier, true); foreach (var node in _modifiers) { var functionCall = node as ScriptFunctionCall; if (functionCall != null) { obj = CallFunction(context.GetFunctionDefinition(_identifier), functionCall, context); continue; } var arrayResolution = node as ScriptArrayResolution; if (arrayResolution != null) { SetArrayValue(obj, arrayResolution, context, value); continue; } var genericPostfix = node as ScriptGenericsPostfix; if (genericPostfix != null) { throw new NotSupportedException(); } } }
private void AssignIdentifier(object value, IScriptContext context) { if (IsGlobal) { SetToParentScope(context.Scope.Parent, _identifier, value); _variable = null; return; } if (IsVar && ((context.Scope is LocalScope) || (context.Scope is FunctionScope))) { context.Scope.CreateVariable(_identifier, value); return; } if (_variable != null) { _variable.Value = value; } else { context.SetItem(_identifier, value); object tmp; _variable = CreateRef(_identifier, context, false, out tmp); } }
private IValueReference CreateRef(string id, IScriptContext context, bool resolve, out object value) { IValueReference result = context.Ref(id); value = RuntimeHost.NoVariable; if (result != null) { result.Removed += ReferenceRemoved; if (resolve) { value = result.Value; } } else { if (resolve) { value = context.GetItem(_identifier, false); } } return(result); }
/// <summary> /// Executes the program stored in the <code>CompiledScript</code> object using /// the supplied <code>Bindings</code> of attributes as the <code>ENGINE_SCOPE</code> of the /// associated <code>ScriptEngine</code> during script execution. If bindings is null, /// then the effect of calling this method is same as that of eval(getEngine().getContext()). /// <para>. /// The <code>GLOBAL_SCOPE</code> <code>Bindings</code>, <code>Reader</code> and <code>Writer</code> /// associated with the default <code>ScriptContext</code> of the associated <code>ScriptEngine</code> are used. /// /// </para> /// </summary> /// <param name="bindings"> The bindings of attributes used for the <code>ENGINE_SCOPE</code>. /// </param> /// <returns> The return value from the script execution /// </returns> /// <exception cref="ScriptException"> if an error occurs. </exception> public virtual object Eval(IBindings bindings) { try { IScriptContext ctxt = GetEngine().GetContext(); if (bindings != null) { SimpleScriptContext tempctxt = new SimpleScriptContext(); tempctxt.SetBindings(bindings, ScriptContext_Fields.ENGINE_SCOPE); tempctxt.SetBindings(ctxt.GetBindings(ScriptContext_Fields.GLOBAL_SCOPE), ScriptContext_Fields.GLOBAL_SCOPE); tempctxt.SetWriter(ctxt.GetWriter()); tempctxt.SetReader(ctxt.GetReader()); tempctxt.SetErrorWriter(ctxt.GetErrorWriter()); ctxt = tempctxt; } return(Eval(ctxt)); } catch (ScriptException ex) { throw ex; } catch (System.Exception ex) { throw new ScriptException(ex); } }
private object MinusEqual(IScriptContext context) { object rez = context.Result; nameExpr.Evaluate(context); object rezName = context.Result; HandleOperatorArgs handling = OnHandleOperator(this, context, "-=", rezName, rez); if (handling.Cancel) { rez = handling.Result; } else { rez = minus.Evaluate(rezName, rez); } //if (!(rezName is EventInfo)) //{ // rez = RuntimeHost.GetBinaryOperator("-").Evaluate(rezName, rez); //} //else //{ // rez = new RemoveDelegate((IInvokable)rez); //} nameExpr.Assign(rez, context); return(rez); }
private object Assign(IScriptContext context) { object rez = context.Result; nameExpr.Assign(rez, context); return(rez); }
public HandleOperatorArgs(IScriptContext context, string symbol, object[] arguments) { Symbol = symbol; Arguments = arguments; Context = context; Cancel = false; }
private void AssignNamePart(object value, IScriptContext context) { _namePart.Evaluate(context); var obj = context.Result; if (_modifiers == null) { SetMember(context, obj, value); return; } //TODO: Bug, first evaluate get member, see unit test AssignmentToArrayObject string localIdentifier = _identifier; for (int index = 0; index < _modifiers.Count; index++) { var scriptFunctionCall = _modifiers[index] as ScriptFunctionCall; if (scriptFunctionCall != null) { if (localIdentifier != null) { CallClassMethod(obj, localIdentifier, scriptFunctionCall, null, context); obj = context.Result; localIdentifier = null; } else { var funcDef = obj as IInvokable; if (funcDef == null) { throw new ScriptExecutionException(string.Format(Strings.ObjectDoesNotImplementIInvokable, Code(context), "", Span.Start.Line, Span.Start.Position)); } obj = CallFunction(funcDef, scriptFunctionCall, context); } continue; } var scriptArrayResolution = _modifiers[index] as ScriptArrayResolution; if (scriptArrayResolution != null) { if (localIdentifier != null) { obj = GetMemberValue(obj, localIdentifier); localIdentifier = null; } if (index == _modifiers.Count - 1) { SetArrayValue(obj, scriptArrayResolution, context, value); } else { GetArrayValue(obj, scriptArrayResolution, context); obj = context.Result; } continue; } } }
public override void Evaluate(IScriptContext context) { if (TypeExpr == null && GenericsPostfix == null) { context.Result = RuntimeHost.GetType(Identifier); return; } if (TypeExpr != null) { string name = string.Format("{0}.{1}", EvaluateName(TypeExpr), Identifier); Type type = null; if (GenericsPostfix != null) { Type genericType = RuntimeHost.GetType(GenericsPostfix.GetGenericTypeName(name)); GenericsPostfix.Evaluate(context); type = genericType.MakeGenericType((Type[])context.Result); } else { type = RuntimeHost.GetType(name); } context.Result = type; } else { Type genericType = RuntimeHost.GetType(Identifier); GenericsPostfix.Evaluate(context); context.Result = genericType.MakeGenericType((Type[])context.Result); } }
private void SetMember(IScriptContext context, object obj, object value) { // Check whether we are setting member value for a dynamic object var dynamicObject = obj as DynamicObject; if (dynamicObject != null) { // Get or create a new call site for a setter var setter = CallSiteCache.GetOrCreatePropertySetter(_identifier); if (setter == null) { throw new ScriptIdNotFoundException(_identifier); } // set property value for the dynamic object setter.Target(setter, obj, value); } else { IMemberBinding bind = RuntimeHost.Binder.BindToMember(obj, _identifier, true); if (bind == null) { throw new ScriptIdNotFoundException(_identifier); } bind.SetValue(value); } context.Result = value; }
public override void Evaluate(IScriptContext context) { // ( Expr ) if (typeExpr == null) { expr.Evaluate(context); } // (Type) Expr else { typeExpr.Evaluate(context); Type type = context.Result as Type; if (type == null) { //NOTE: Handling special case of unary minus operator: // (3+2)-2; ScriptUnaryExpr unary = expr as ScriptUnaryExpr; if (unary == null || unary.OperationSymbol != "-") throw new ScriptException("Wrong type expression!"); //NOTE: expr + (unary expr) object left = context.Result; unary.Evaluate(context); context.Result = @operator.Evaluate(left, context.Result); return; } expr.Evaluate(context); context.Result = RuntimeHost.Binder.ConvertTo(context.Result, type); } }
private async Task PerformCallbacks( HttpContext httpContext, IMockacoContext mockacoContext, IScriptContext scriptContext, ITemplateTransformer templateTransformer, MockacoOptions options) { try { var stopwatch = Stopwatch.StartNew(); var template = await templateTransformer.Transform(mockacoContext.Mock.RawTemplate, scriptContext); var callbackTasks = new List <Task>(); foreach (var callbackTemplate in template.Callbacks) { callbackTasks.Add(PerformCallback(httpContext, callbackTemplate, options, stopwatch.ElapsedMilliseconds)); } await Task.WhenAll(callbackTasks); } catch (Exception ex) { _logger.LogError(ex, "Error preparing callback(s)"); } }
private object PlusEqual(IScriptContext context) { object rez = context.Result; nameExpr.Evaluate(context); object rezName = context.Result; HandleOperatorArgs handling = OnHandleOperator(this, context, "+=", rezName, rez); if (handling.Cancel) { rez = handling.Result; } else { rez = plus.Evaluate(rezName, rez); } //TODO: Events! //if (!(rezName is EventInfo)) //{ // rez = RuntimeHost.GetBinaryOperator("+").Evaluate(rezName, rez); //} nameExpr.Assign(rez, context); return(rez); }
public object Invoke(IScriptContext context, object[] args) { if (args == null || args.Length == 0) return new object[0]; Array result = null; Type type = args[0] as Type; if (type != null) { result = Array.CreateInstance(type, args.Length - 1); Array.Copy(args, 1, result, 0, result.Length); return result; } type = null; foreach (object item in args) { if (item == null) continue; if (type == null) { type = item.GetType(); continue;} if (type != item.GetType()) return args.Clone(); } if (type == null) return args.Clone(); result = Array.CreateInstance(type, args.Length); Array.Copy(args, result, result.Length); return result; }
public object Invoke(IScriptContext context, object[] args) { bool scopeOwner = false; if (args != null) { if (args.Length > 1) throw new ArgumentException("Number of arguments "); if (args.Length == 1) { var assigner = args[0] as ISupportAssign; if (assigner == null) throw new NotSupportedException("Given type of argument is not supported"); assigner.AssignTo(context.CreateScope()); scopeOwner = true; } } try { _metaProg.Evaluate(context); return context.Result; } finally { if (scopeOwner) context.RemoveLocalScope(); } }
//TODO: Refactor public override void Evaluate(IScriptContext context) { if (ChildNodes.Count == 0) return; //Create local scope if (ShouldCreateScope) { IScriptScope scope = RuntimeHost.ScopeFactory.Create(ScopeTypes.Local, context.Scope); context.CreateScope(scope); } try { int index = 0; while (index < ChildNodes.Count) { var node = (ScriptAst)ChildNodes[index]; node.Evaluate(context); if (context.IsBreak() || context.IsReturn() || context.IsContinue()) { break; } index++; } } finally { if (ShouldCreateScope) context.RemoveLocalScope(); } }
public override void Evaluate(IScriptContext context) { condition.Evaluate(context); object lastResult = RuntimeHost.NullValue; while ((bool)context.Result) { statement.Evaluate(context); lastResult = context.Result; if (context.IsBreak() || context.IsReturn()) { context.SetBreak(false); break; } if (context.IsContinue()) { context.SetContinue(false); } condition.Evaluate(context); } context.Result = lastResult; }
public override void Evaluate(IScriptContext context) { _constrExpr.Evaluate(context); var call = (IBinding)context.Result; context.Result = RuntimeHost.Activator.CreateInstance(context, call); }
public override void Evaluate(IScriptContext context) { if (context.Scope == null) throw new ScriptExecutionException("Null scope"); context.Scope.CreateVariable(_identifier, null); }
public object Invoke(IScriptContext context, object[] args) { string code = (String)args[0]; ScriptAst result = null; LanguageCompiler compiler = (LanguageCompiler) context.GetItem("Compiler", true); RuntimeHost.Lock(); try { result = Script.Parse(code + ";", false) as ScriptAst; //TODO: Create LocalOnlyScope that can't change Parent's variables //No, need for doing these. It is already done context.CreateScope(); } finally { RuntimeHost.UnLock(); } result.Evaluate(context); context.RemoveLocalScope(); return context.Result; }
public void CheckPre(IScriptContext context) { if (!CheckCondition(pre, context)) { throw new ScriptVerificationException("Pre condition for function call failed"); } }
public override void Evaluate(IScriptContext context) { if (Name != null) context.SetItem(Name, this); context.Result = this; }
/// <summary> /// Executes the given script file /// </summary> /// <param name="path">The path to the file.</param> /// <param name="entryPoint">The entry function to call.</param> /// <param name="context">The script context. Can be null if there is none.</param> /// <param name="container">The dependency container.</param> /// <param name="arguments">The arguments for the entry point.</param> /// <returns>The result of the script execution.</returns> public virtual ScriptResult ExecuteFile( string path, IDependencyContainer container, ref IScriptContext context, string entryPoint, params object[] arguments ) => ExecuteFile(path, container, ref context, null, false, entryPoint, arguments);
public override void Evaluate(IScriptContext context) { name.Evaluate(context); context.CreateScope(RuntimeHost.ScopeFactory.Create(ScopeTypes.Using, context.Scope, context.Result)); statement.Evaluate(context); context.RemoveLocalScope(); }
public override void Evaluate(IScriptContext context) { var local = context.Scope as LocalScope; if (local != null) local.CreateVariable(_identifier, null); else context.SetItem(_identifier, null); }
public ELContextAnonymousInnerClassHelper(JuelScriptEngine outerInstance, IScriptContext scriptCtx) { this.outerInstance = outerInstance; this.scriptCtx = scriptCtx; resolver = outerInstance.CreateElResolver(); varMapper = new ScriptContextVariableMapper(outerInstance, scriptCtx); funcMapper = new ScriptContextFunctionMapper(outerInstance, scriptCtx); }
public override void Evaluate(IScriptContext context) { _conditionExpression.Evaluate(context); #if DEBUG if (!(context.Result is bool)) throw new ScriptVerificationException(Strings.VerificationNonBoolean); #endif }
public override void Evaluate(IScriptContext context) { if (rightExpr != null) { rightExpr.Evaluate(context); } context.Result = assignOperation(context); }
public override void Evaluate(IScriptContext context) { if (args == null) { context.Result = Empty; return; } args.Evaluate(context); }
protected static HandleOperatorArgs OnHandleOperator(object sender, IScriptContext context, string symbol, params object[] parameters) { HandleOperatorArgs args = new HandleOperatorArgs(context, symbol, parameters); if (HandleOperator != null) HandleOperator.Invoke(sender, args); return args; }
public override void Evaluate(IScriptContext context) { typeExpr.Evaluate(context); Type type = (Type)context.Result; callExpr.Evaluate(context); object[] arguments = (object[])context.Result; context.Result = RuntimeHost.Binder.BindToConstructor(type, arguments); }
public void CheckInv(IScriptContext context) { if (_function == null) throw new NullReferenceException("Function"); if (!CheckCondition(_inv, context)) { throw new ScriptVerificationException(string.Format(Strings.VerificationInvariantCondition, _function.Name, Code(context))); } }