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); }
public static IXamlILEmitter EmitCall(this IXamlILEmitter emitter, IXamlMethod method, bool swallowResult = false) { if (method is IXamlCustomEmitMethod <IXamlILEmitter> 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); }
public override void Emit(IXamlILEmitter codegen) { codegen.Pop(); EmitSetValue(codegen); }