protected virtual void EmitCheckPropertyImmutability( PropertyModel propertyModel, CompositeTypeGenerationInfo thisGenerationInfo, MethodIL il ) { if (propertyModel.IsImmutable) { var setPropertyLabelWrapper = il.DefineLabel(); il .EmitLoadThisField(thisGenerationInfo.CompositeField) .EmitCall(IS_PROTOTYPE_GETTER) .EmitBranch(BranchType.IF_TRUE, setPropertyLabelWrapper) .EmitLoadString("Can not set immutable property ") .EmitReflectionObjectOf(thisGenerationInfo.Parents[propertyModel.NativeInfo.DeclaringType.NewWrapperAsType(this.ctx)]) .EmitLoadString(propertyModel.NativeInfo.Name) .EmitCall(QNAME_FROM_TYPE_AND_NAME) .EmitCall(TO_STRING_METHOD) .EmitLoadString("for a non-prototype composite instance.") .EmitCall(STRING_CONCAT_METHOD_3) .EmitThrowNewException(INVALID_OPERATION_EXCEPTION_CTOR_WITH_STRING) .MarkLabel(setPropertyLabelWrapper); } }
protected virtual void EmitEventCheckMethodForStronglyReferencedEvents( CILField eventField, MethodIL il ) { il.EmitLoadThisField(eventField) .EmitLoadNull() .EmitCeq() .EmitLoadInt32(0) .EmitCeq() .EmitReturn(); }