Пример #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);