Exemplo n.º 1
0
 public XamlIlNodeEmitResult Emit(XamlIlEmitContext context, IXamlIlEmitter codeGen)
 {
     // Discard the stack value we are "supposed" to manipulate
     codeGen.Pop();
     context.Emit(Imperative, codeGen, null);
     return(XamlIlNodeEmitResult.Void(1));
 }
Exemplo n.º 2
0
            public override void Emit(IXamlIlEmitter codegen)
            {
                var unsetValue = Types.AvaloniaProperty.Fields.First(f => f.Name == "UnsetValue");

                codegen
                // Ignore the instance and load one from the static field to avoid extra local variable
                .Pop()
                .Ldsfld(AvaloniaProperty)
                .Ldsfld(unsetValue)
                .Ldc_I4(0)
                .EmitCall(Types.AvaloniaObjectSetValueMethod, true);
            }
Exemplo n.º 3
0
        public static IXamlIlEmitter EmitCall(this IXamlIlEmitter emitter, IXamlIlMethod method, bool swallowResult = false)
        {
            if (method is IXamlIlCustomEmitMethod custom)
            {
                custom.EmitCall(emitter);
            }
            else
            {
                emitter.Emit(method.IsStatic ? OpCodes.Call : OpCodes.Callvirt, method);
            }

            if (swallowResult && !(method.ReturnType.Namespace == "System" && method.ReturnType.Name == "Void"))
            {
                emitter.Pop();
            }
            return(emitter);
        }
Exemplo n.º 4
0
        public XamlIlNodeEmitResult Emit(IXamlIlAstNode node, XamlIlEmitContext context, IXamlIlEmitter codeGen)
        {
            if (!(node is XamlIlManipulationGroupNode group))
            {
                return(null);
            }
            if (group.Children.Count == 0)
            {
                codeGen.Pop();
            }
            else
            {
                for (var c = 0; c < group.Children.Count; c++)
                {
                    if (c != group.Children.Count - 1)
                    {
                        codeGen.Emit(OpCodes.Dup);
                    }
                    context.Emit(group.Children[c], codeGen, null);
                }
            }

            return(XamlIlNodeEmitResult.Void(1));
        }