public CallFormula(Formula instance, MethodInfo mi, Formula[] arguments) : base() { Instance = instance; Method = mi.ToMethodDecl(); arguments.AddRangeTo(Arguments); }
public Formula Visit(Formula formula) { return formula; }
public ReturnFormula(Formula body) { Body = body; }
void IncreaseIfNecessary(Formula formula, Func<Formula, ITypeDeclaration> getExpectedType, Action<Formula> increase) { if (formula != null) { var expectedType = getExpectedType(formula); if (!expectedType.IsValueType && formula.TypeDeclaration.IsValueType && expectedType.IsAssignableFrom(formula.TypeDeclaration)) { var convert = new ConvertFormula(formula, expectedType); increase(convert); } } }
public virtual Formula Visit(Formula formula) { return visitor.Visit(formula); }
public ReflectiveFieldFormula(Formula instance, FieldInfo fi) : base(instance, fi) { }
protected override void InitializeForCodeGeneration() { base.InitializeForCodeGeneration(); NodeType = NodeType.Return; Body = default(Formula); }
public static void EvalStaticMethodCall(MethodCallExpression exp, ExpressionToFormulaState state) { EvalArguments(exp.Arguments, state); var arguments = new Formula[state.Arguments.Count]; state.Arguments.MoveTo(arguments); state.CurrentBlock.Formulas.Push(new CallFormula(null, exp.Method, arguments)); }
public static void EvalNew(NewExpression exp, ExpressionToFormulaState state) { EvalArguments(exp.Arguments, state); var arguments = new Formula[state.Arguments.Count]; state.Arguments.MoveTo(arguments); state.CurrentBlock.Formulas.Push(new NewFormula(exp.Constructor, arguments)); }
public static void EvalNewArrayInit(NewArrayExpression exp, ExpressionToFormulaState state) { EvalArguments(exp.Expressions, state); var arguments = new Formula[state.Arguments.Count]; state.Arguments.MoveTo(arguments); state.CurrentBlock.Formulas.Push(new NewArrayInitFormula(arguments, exp.Type)); }
public static void EvalMethodInfoInvoke_object_objects(MethodCallExpression exp, ExpressionToFormulaState state) { exp.Object.ConvertTo(state.InlineValueState); var mi = (MethodInfo)state.InlineValueState.Result; var instance = default(Formula); if (!mi.IsStatic) { EvalExpression(exp.Arguments[0], state); instance = state.CurrentBlock.Formulas.Pop(); } var arguments = new Formula[] { }; if (exp.Arguments[1].NodeType == ExpressionType.NewArrayInit) { EvalArguments(((NewArrayExpression)exp.Arguments[1]).Expressions, state); arguments = new Formula[state.Arguments.Count]; state.Arguments.MoveTo(arguments); } else { throw new NotImplementedException(); } state.CurrentBlock.Formulas.Push(new ReflectiveCallFormula(instance, mi, arguments)); }
public static void EvalConstructorInfoInvoke_objects(MethodCallExpression exp, ExpressionToFormulaState state) { exp.Object.ConvertTo(state.InlineValueState); var ci = (ConstructorInfo)state.InlineValueState.Result; var arguments = new Formula[] { }; if (exp.Arguments[0].NodeType == ExpressionType.NewArrayInit) { EvalArguments(((NewArrayExpression)exp.Arguments[0]).Expressions, state); arguments = new Formula[state.Arguments.Count]; state.Arguments.MoveTo(arguments); } else if (exp.Arguments[0].NodeType == ExpressionType.Constant && ((ConstantExpression)exp.Arguments[0]).Value == null) { // discard... } else { throw new NotImplementedException(); } state.CurrentBlock.Formulas.Push(new ReflectiveNewFormula(ci, arguments)); }
public FieldFormula(Formula instance, FieldInfo fi) { Instance = instance; Member = fi.ToFieldDecl(); }
public NewArrayInitFormula(Formula[] formulas, Type type) { formulas.AddRangeTo(Formulas); TypeDeclaration = type.ToTypeDecl(); }
public TypeAsFormula(Formula operand, Type type) { Operand = operand; TypeDeclaration = type.ToTypeDecl(); }
public PropertyFormula(Formula instance, PropertyInfo pi) { Instance = instance; Member = pi.ToPropertyDecl(); }
protected override void InitializeForCodeGeneration() { base.InitializeForCodeGeneration(); NodeType = NodeType.None; Left = default(Formula); Method = default(IMethodDeclaration); Right = default(Formula); }
protected override void InitializeForCodeGeneration() { base.InitializeForCodeGeneration(); NodeType = NodeType.Conditional; Test = default(Formula); IfTrue = default(Formula); IfFalse = default(Formula); }
public ReflectiveNewFormula(ConstructorInfo ci, Formula[] arguments) : base(ci, arguments) { }
public ReflectivePropertyFormula(Formula instance, PropertyInfo pi) : base(instance, pi) { }
public NewFormula(ConstructorInfo ci, Formula[] arguments) { Constructor = ci.ToConstructorDecl(); arguments.AddRangeTo(Arguments); }