public IfEmitter(DynamicMethodBody generator) { _generator = generator; _ifFalse = $"IfFalse_{Guid.NewGuid()}"; _done = $"Done_{Guid.NewGuid()}"; LeftSideVarName = $"LS_{Guid.NewGuid()}"; }
public override void BuildIL(DynamicMethodBody dynamicMethodBody) { for (int i = 0; i < NestedSourceProperties.Count - 1; i++) { dynamicMethodBody .Ldarg("source"); for (int x = 0; x <= i; x++) { dynamicMethodBody .Call(this.NestedSourceProperties[x].GetGetMethod()); } dynamicMethodBody .IfNotNull(); } dynamicMethodBody .Ldarg("target") .Ldarg("source"); foreach (PropertyInfo propertyInfo in NestedSourceProperties) { dynamicMethodBody.Call(propertyInfo.GetGetMethod()); } dynamicMethodBody .Call(this.TargetProperty.GetSetMethod()); for (int i = 0; i < NestedSourceProperties.Count - 1; i++) { dynamicMethodBody .EndIf(); } }
public IfEmitter(DynamicMethodBody generator) { generatorField = generator; ifFalseField = string.Format("IfFalse_{0}", Guid.NewGuid()); doneField = string.Format("Done_{0}", Guid.NewGuid()); LeftSideVarName = string.Format("LS_{0}", Guid.NewGuid()); }
internal Parser(IEnumerable<Token> source, DynamicMethodBody body = null) { Source = source; MethodBody = body; _result = new ParseResult(this); }
public static ParseResult Parse(string expression, DynamicMethodBody methodBody = null) { return new Parser( new ExpressionScanner().Scan(expression), methodBody ).Parse(); }
public override void BuildIL(DynamicMethodBody dynamicMethodBody) { dynamicMethodBody .Ldarg("target") .Ldarg("source") .Call(this.SourceProperty.GetGetMethod()) .Call(this.TargetProperty.GetSetMethod()); }
public static void Parse(string expression, DynamicMethodBody methodBody = null) { new Parser( new ExpressionScanner().Scan(expression), methodBody ).Parse(); }
internal Parser(IEnumerable<Token> source, DynamicMethodBody body = null) { Source = source; MethodBody = body; }
// ReSharper restore InconsistentNaming public ILEmitterVisitor(DynamicMethodBody dmb) { IL = dmb; }
public override void Emit(DynamicMethodBody generator) { Parser.Parse(Expression, generator); }
public override void Emit(DynamicMethodBody generator) { generator.Ldc(Value); }
public override void Emit(DynamicMethodBody generator) { generator.Expression(Expression); }
public abstract void BuildIL(DynamicMethodBody dynamicMethodBody);
public abstract void Emit(DynamicMethodBody generator);