示例#1
0
 public IfEmitter(DynamicMethodBody generator)
 {
     _generator = generator;
     _ifFalse = $"IfFalse_{Guid.NewGuid()}";
     _done = $"Done_{Guid.NewGuid()}";
     LeftSideVarName = $"LS_{Guid.NewGuid()}";
 }
示例#2
0
 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();
            }
        }
示例#4
0
 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());
 }
示例#5
0
		internal Parser(IEnumerable<Token> source,
						DynamicMethodBody body = null)
		{
			Source = source;
			MethodBody = body;
			_result = new ParseResult(this);
		}
示例#6
0
 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());
 }
示例#8
0
 public static void Parse(string expression,
                          DynamicMethodBody methodBody = null)
 {
     new Parser(
         new ExpressionScanner().Scan(expression),
         methodBody
         ).Parse();
 }
示例#9
0
 internal Parser(IEnumerable<Token> source,
                 DynamicMethodBody body = null)
 {
     Source = source;
     MethodBody = body;
 }
示例#10
0
// ReSharper restore InconsistentNaming

        public ILEmitterVisitor(DynamicMethodBody dmb)
        {
            IL = dmb;
        }
示例#11
0
 public override void Emit(DynamicMethodBody generator)
 {
     Parser.Parse(Expression, generator);
 }
示例#12
0
 public override void Emit(DynamicMethodBody generator)
 {
     generator.Ldc(Value);
 }
示例#13
0
 public override void Emit(DynamicMethodBody generator)
 {
     generator.Expression(Expression);
 }
 public abstract void BuildIL(DynamicMethodBody dynamicMethodBody);
示例#15
0
 public abstract void Emit(DynamicMethodBody generator);