Esempio n. 1
0
 public override void Emit(IXamlILEmitter emitter)
 {
     using (var bloc = emitter.LocalsPool.GetLocal(Types.IBinding))
         emitter
         .Stloc(bloc.Local)
         .Ldsfld(AvaloniaProperty)
         .Ldloc(bloc.Local);
     EmitAnchorAndBind(emitter);
 }
Esempio n. 2
0
 public override void Emit(IXamlILEmitter emitter)
 {
     using (var bloc = emitter.LocalsPool.GetLocal(Types.IBinding))
         emitter
         .Stloc(bloc.Local)
         .Ldsfld(AvaloniaProperty)
         .Ldloc(bloc.Local)
         // TODO: provide anchor?
         .Ldnull();
     emitter.EmitCall(Types.AvaloniaObjectBindMethod, true);
 }
        public static void EmitConvert(XamlEmitContextWithLocals <IXamlILEmitter, XamlILNodeEmitResult> context, IXamlILEmitter ilgen, IXamlLineInfo node,
                                       IXamlType what,
                                       IXamlType to)
        {
            XamlLocalsPool.PooledLocal local = null;

            EmitConvert(context, node, what, to, lda =>
            {
                if (!lda)
                {
                    return(ilgen);
                }
                local = ilgen.LocalsPool.GetLocal(what);
                ilgen
                .Stloc(local.Local)
                .Ldloca(local.Local);
                return(ilgen);
            });
            local?.Dispose();
        }
            public void Emit(IXamlILEmitter emitter)
            {
                var locals = new Stack <XamlLocalsPool.PooledLocal>();

                // Save all "setter" parameters
                for (var c = Parameters.Count - 1; c >= 0; c--)
                {
                    var loc = emitter.LocalsPool.GetLocal(Parameters[c]);
                    locals.Push(loc);
                    emitter.Stloc(loc.Local);
                }

                emitter.EmitCall(_getter);
                while (locals.Count > 0)
                {
                    using (var loc = locals.Pop())
                        emitter.Ldloc(loc.Local);
                }
                emitter.EmitCall(_adder, true);
            }
Esempio n. 5
0
            public override void Emit(IXamlILEmitter emitter)
            {
                /*
                 * Current stack:
                 * - object
                 * - binding priority
                 * - value
                 */

                using (var valueLocal = emitter.LocalsPool.GetLocal(Parameters[1]))
                    using (var priorityLocal = emitter.LocalsPool.GetLocal(Types.Int))
                        emitter
                        .Stloc(valueLocal.Local)
                        .Stloc(priorityLocal.Local)
                        .Ldsfld(AvaloniaProperty)
                        .Ldloc(valueLocal.Local)
                        .Ldloc(priorityLocal.Local);

                EmitSetStyledPropertyValue(emitter);
            }