Esempio n. 1
0
            public XamlIlNodeEmitResult Emit(XamlIlEmitContext context, IXamlIlEmitter codeGen)
            {
                var next       = codeGen.DefineLabel();
                var scopeField = context.RuntimeContext.ContextType.Fields.First(f =>
                                                                                 f.Name == AvaloniaXamlIlLanguage.ContextNameScopeFieldName);

                using (var local = codeGen.LocalsPool.GetLocal(_types.StyledElement))
                {
                    codeGen
                    .Isinst(_types.StyledElement)
                    .Dup()
                    .Stloc(local.Local)
                    .Brfalse(next)
                    .Ldloc(local.Local)
                    .Ldloc(context.ContextLocal)
                    .Ldfld(scopeField)
                    .EmitCall(_types.NameScopeSetNameScope, true)
                    .MarkLabel(next)
                    .Ldloc(context.ContextLocal)
                    .Ldfld(scopeField)
                    .EmitCall(_types.INameScopeComplete, true);
                }

                return(XamlIlNodeEmitResult.Void(1));
            }