public override void AppendStructure(StringBuilder b, Bindings bindings) { b.Append("("); child.AppendStructure(b, bindings); b.Append(")"); }
public override bool IsReadOnly(Bindings bindings, ELContext context) { return(true); }
public abstract ValueReference GetValueReference(Bindings bindings, ELContext context);
public abstract object Eval(Bindings bindings, ELContext context);
public abstract MethodInfo GetMethodInfo(Bindings bindings, ELContext context, Type returnType, Type[] paramTypes);
public abstract bool IsReadOnly(Bindings bindings, ELContext context);
public override void AppendStructure(StringBuilder b, Bindings bindings) { b.Append(bindings != null && bindings.IsFunctionBound(index) ? "<fn>" : name); @params.AppendStructure(b, bindings); }
public override void SetValue(Bindings bindings, ELContext context, object value) { child.SetValue(bindings, context, value); }
public override void AppendStructure(StringBuilder builder, Bindings bindings) { property.AppendStructure(builder, bindings); @params.AppendStructure(builder, bindings); }
public override object Eval(Bindings bindings, ELContext context) { return(Invoke(bindings, context, null, null, null)); }
public sealed override ValueReference GetValueReference(Bindings bindings, ELContext context) { return(null); }
public override MethodInfo GetMethodInfo(Bindings bindings, ELContext context, Type returnType, Type[] paramTypes) { return(null); }
public override void SetValue(Bindings bindings, ELContext context, object value) { throw new ELException(LocalMessages.Get("error.value.set.rvalue", GetStructuralId(bindings))); }
public override Type GetType(Bindings bindings, ELContext context) { return(child.GetType(bindings, context)); }
/// <summary> /// Invoke method. </summary> /// <param name="bindings"> </param> /// <param name="context"> </param> /// <param name="base"> </param> /// <param name="method"> </param> /// <returns> method result </returns> /// <exception cref="TargetInvocationException"> </exception> /// <exception cref="AccessViolationException"> </exception> protected internal virtual object Invoke(Bindings bindings, ELContext context, object @base, MethodInfo method) { Type[] types = method.GetParameters().Select(c => c.ParameterType).ToArray(); object[] @params = null; if (types.Length > 0) { @params = new object[types.Length]; //if (varargs && method.GetParameters().Any()) if (method.ContainsGenericParameters && method.GetParameters().Any()) { for (int i = 0; i < @params.Length - 1; i++) { object param = GetParam(i).Eval(bindings, context); if (param != null || types[i].IsPrimitive) { @params[i] = bindings.Convert <object>(param, types[i]); } } int varargIndex = types.Length - 1; Type varargType = types[varargIndex]; int length = ParamCount - varargIndex; object array = null; if (length == 1) { // special: eventually use argument as is object param = GetParam(varargIndex).Eval(bindings, context); if (param != null && param.GetType().IsArray) { if (types[varargIndex].IsInstanceOfType(param)) { array = param; } else { // coerce array elements //length = Array.GetLength(param); //array = Array.CreateInstance(varargType, length); //for (int i = 0; i < length; i++) //{ // object elem = Array.Get(param, i); // if (elem != null || varargType.IsPrimitive) // { // ((System.Array)array).SetValue(bindings.Convert(elem, varargType), i); // } //} } } else { // single element array array = Array.CreateInstance(varargType, 1); if (param != null || varargType.IsPrimitive) { ((System.Array)array).SetValue(bindings.Convert <object>(param, varargType), 0); } } } else { array = Array.CreateInstance(varargType, length); for (int i = 0; i < length; i++) { object param = GetParam(varargIndex + i).Eval(bindings, context); if (param != null || varargType.IsPrimitive) { ((System.Array)array).SetValue(bindings.Convert <object>(param, varargType), i); } } } @params[varargIndex] = array; } else { for (int i = 0; i < @params.Length; i++) { object param = GetParam(i).Eval(bindings, context); if (param != null || types[i].IsPrimitive) { @params[i] = bindings.Convert <object>(param, types[i]); } } } } return(method.Invoke(@base, @params)); }
public override bool IsReadOnly(Bindings bindings, ELContext context) { return(child.IsReadOnly(bindings, context)); }
protected internal override object GetProperty(Bindings bindings, ELContext context) { return(property); }
public abstract object Invoke(Bindings bindings, ELContext context, Type returnType, Type[] paramTypes, object[] paramValues);
public override void AppendStructure(StringBuilder b, Bindings bindings) { ((AstDot)GetChild(0)).AppendStructure(b, bindings); b.Append("."); b.Append(property); }
public abstract void SetValue(Bindings bindings, ELContext context, object value);
public override ValueReference GetValueReference(Bindings bindings, ELContext context) { return(child.GetValueReference(bindings, context)); }
public abstract Type GetType(Bindings bindings, ELContext context);
public override void AppendStructure(StringBuilder b, Bindings bindings) { b.Append(deferred ? "#{" : "${"); child.AppendStructure(b, bindings); b.Append("}"); }
public abstract void AppendStructure(StringBuilder builder, Bindings bindings);
public override MethodInfo GetMethodInfo(Bindings bindings, ELContext context, Type returnType, Type[] paramTypes) { return(child.GetMethodInfo(bindings, context, returnType, paramTypes)); }
public override object Eval(Bindings bindings, ELContext context) { return(child.Eval(bindings, context)); }
public override object Invoke(Bindings bindings, ELContext context, Type returnType, Type[] paramTypes, object[] paramValues) { return(child.Invoke(bindings, context, returnType, paramTypes, paramValues)); }
public override void AppendStructure(StringBuilder b, Bindings bindings) { b.Append(bindings != null && bindings.IsVariableBound(index) ? "<var>" : name); }
public override Type GetType(Bindings bindings, ELContext context) { return(null); }