// Token: 0x06000237 RID: 567 RVA: 0x00003643 File Offset: 0x00001843 public PropertyDecorator(TypeModel model, Type forType, PropertyInfo property, IProtoSerializer tail) : base(tail) { this.forType = forType; this.property = property; PropertyDecorator.SanityCheck(model, property, tail, out this.readOptionsWriteValue, true, true); this.shadowSetter = PropertyDecorator.GetShadowSetter(model, property); }
protected override void EmitRead(CompilerContext ctx, Local valueFrom) { bool flag; PropertyDecorator.SanityCheck(ctx.Model, this.property, this.Tail, out flag, ctx.NonPublic, ctx.AllowInternal(this.property)); if (this.ExpectedType.IsValueType && valueFrom == null) { throw new InvalidOperationException("Attempt to mutate struct on the head of the stack; changes would be lost"); } using (Local localWithValue = ctx.GetLocalWithValue(this.ExpectedType, valueFrom)) { if (this.Tail.RequiresOldValue) { ctx.LoadAddress(localWithValue, this.ExpectedType); ctx.LoadValue(this.property); } Type propertyType = this.property.PropertyType; ctx.ReadNullCheckedTail(propertyType, this.Tail, null); if (flag) { using (Local local = new Local(ctx, this.property.PropertyType)) { ctx.StoreValue(local); CodeLabel codeLabel = new CodeLabel(); if (!propertyType.IsValueType) { codeLabel = ctx.DefineLabel(); ctx.LoadValue(local); ctx.BranchIfFalse(codeLabel, true); } ctx.LoadAddress(localWithValue, this.ExpectedType); ctx.LoadValue(local); if (this.shadowSetter != null) { ctx.EmitCall(this.shadowSetter); } else { ctx.StoreValue(this.property); } if (!propertyType.IsValueType) { ctx.MarkLabel(codeLabel); } } } else if (this.Tail.ReturnsValue) { ctx.DiscardValue(); } } }