public object Eval(IScriptExpression expression, ScriptParameterList parameters) { ScriptExpression scriptExpression = (ScriptExpression)expression; var args = parameters.Select(p => new DynamicExpresso.Parameter(p.Name, p.Type, p.Value)).ToArray(); return scriptExpression.ExpressionDefinition.Invoke(args); }
private object EvalScript(IScriptExpression expression, Dictionary<string, object> modules, ContextParameterList parameters) { var argParameters = new ScriptParameterList(); foreach (var m in modules) argParameters.Add(new ScriptParameter(m.Key, m.Value.GetType(), m.Value)); foreach (var p in parameters) argParameters.Add(new ScriptParameter(p.Name, p.Type, p.Value)); return _scriptService.Eval(expression, argParameters); }
public XValue(Type valueType, IScriptExpression expression) { if (valueType == null) throw new ArgumentNullException("valueType"); if (expression == null) throw new ArgumentNullException("expression"); if (!valueType.IsAssignableFrom(expression.ReturnType)) throw new ApplicationException(string.Format("Cannot convert type '{1}' to type '{0}'.", valueType, expression.ReturnType)); ValueType = valueType; _expression = expression; }
public object Eval(IScriptExpression expression, ScriptParameterList parameters) { return _evalObject; }
public ScriptExpressionNode(IScriptExpression scriptExpression) { Infra.NotNull(scriptExpression.Expression); _scriptExpression = scriptExpression; }
protected override void Visit(ref IScriptExpression entity) { entity = new Evaluator(entity.Expression); }
public EcmaScriptScriptExpressionEvaluator(IScriptExpression scriptExpression, Program program) { _scriptExpression = scriptExpression; _program = program; }
public void SetBody(IScriptExpression body) => _body = body ?? throw new ArgumentNullException(nameof(body));