コード例 #1
0
ファイル: CompilerHelpers.cs プロジェクト: OmniUI/XamlIl2
 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));
 }
コード例 #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);
            }
コード例 #3
0
ファイル: TypeSystem.cs プロジェクト: zawodskoj/XamlIl
        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);
        }
コード例 #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));
        }