protected override void FreezeInternal() { returnTypeAttributes = FreezableHelper.FreezeListAndElements(returnTypeAttributes); typeParameters = FreezableHelper.FreezeListAndElements(typeParameters); parameters = FreezableHelper.FreezeListAndElements(parameters); base.FreezeInternal(); }
protected override void FreezeInternal() { parameters = FreezableHelper.FreezeListAndElements(parameters); FreezableHelper.Freeze(getter); FreezableHelper.Freeze(setter); base.FreezeInternal(); }
protected override void FreezeInternal() { base.FreezeInternal(); FreezableHelper.Freeze(addAccessor); FreezableHelper.Freeze(removeAccessor); FreezableHelper.Freeze(invokeAccessor); }
protected override void FreezeInternal() { base.FreezeInternal(); baseTypes = FreezableHelper.FreezeList(baseTypes); typeParameters = FreezableHelper.FreezeListAndElements(typeParameters); nestedTypes = FreezableHelper.FreezeListAndElements(nestedTypes); members = FreezableHelper.FreezeListAndElements(members); }
protected virtual void FreezeInternal() { attributes = FreezableHelper.FreezeListAndElements(attributes); if (rareFields != null) { rareFields.FreezeInternal(); } }
/// <summary> /// Uses the specified interning provider to intern /// strings and lists in this entity. /// This method does not test arbitrary objects to see if they implement ISupportsInterning; /// instead we assume that those are interned immediately when they are created (before they are added to this entity). /// </summary> public virtual void ApplyInterningProvider(InterningProvider provider) { if (provider == null) throw new ArgumentNullException("provider"); FreezableHelper.ThrowIfFrozen(this); name = provider.Intern(name); attributes = provider.InternList(attributes); constraints = provider.InternList(constraints); }
protected override void FreezeInternal() { base.FreezeInternal(); assemblyAttributes = FreezableHelper.FreezeListAndElements(assemblyAttributes); moduleAttributes = FreezableHelper.FreezeListAndElements(moduleAttributes); foreach (var type in typeDefinitions.Values) { FreezableHelper.Freeze(type); } }
void SetFlag(byte flag, bool value) { FreezableHelper.ThrowIfFrozen(this); if (value) { this.flags |= flag; } else { this.flags &= unchecked ((byte)~flag); } }
protected override void FreezeInternal() { base.FreezeInternal(); constructorParameterTypes = FreezableHelper.FreezeList(constructorParameterTypes); positionalArguments = FreezableHelper.FreezeListAndElements(positionalArguments); namedArguments = FreezableHelper.FreezeList(namedArguments); foreach (var pair in namedArguments) { FreezableHelper.Freeze(pair.Key); FreezableHelper.Freeze(pair.Value); } }
/// <summary> /// Adds a type forwarder. /// This adds both an assembly attribute and an internal forwarder entry, which will be used /// by the resolved assembly to provide the forwarded types. /// </summary> /// <param name="typeName">The name of the type.</param> /// <param name="referencedType">The reference used to look up the type in the target assembly.</param> public void AddTypeForwarder(TopLevelTypeName typeName, ITypeReference referencedType) { if (referencedType == null) { throw new ArgumentNullException("referencedType"); } FreezableHelper.ThrowIfFrozen(this); var attribute = new DefaultUnresolvedAttribute(typeForwardedToAttributeTypeRef, new[] { KnownTypeReference.Type }); attribute.PositionalArguments.Add(new TypeOfConstantValue(referencedType)); assemblyAttributes.Add(attribute); typeForwarders[typeName] = referencedType; }
/// <summary> /// Adds a new top-level type definition to this assembly. /// </summary> /// <remarks>DefaultUnresolvedAssembly does not support partial classes. /// Adding more than one part of a type will cause an ArgumentException.</remarks> public void AddTypeDefinition(IUnresolvedTypeDefinition typeDefinition) { if (typeDefinition == null) { throw new ArgumentNullException("typeDefinition"); } if (typeDefinition.DeclaringTypeDefinition != null) { throw new ArgumentException("Cannot add nested types."); } FreezableHelper.ThrowIfFrozen(this); var key = new TopLevelTypeName(typeDefinition.Namespace, typeDefinition.Name, typeDefinition.TypeParameters.Count); typeDefinitions.Add(key, typeDefinition); }
public override ISupportsInterning Intern(ISupportsInterning obj) { if (obj == null) { return(null); } // ensure objects are frozen when we put them into the dictionary // note that Freeze may change the hash code of the object FreezableHelper.Freeze(obj); ISupportsInterning output; if (supportsInternDict.TryGetValue(obj, out output)) { return(output); } else { supportsInternDict.Add(obj, obj); return(obj); } }
protected override void FreezeInternal() { base.FreezeInternal(); this.attributes = FreezableHelper.FreezeListAndElements(this.attributes); this.returnTypeAttributes = FreezableHelper.FreezeListAndElements(this.returnTypeAttributes); }
protected void ThrowIfFrozen() { FreezableHelper.ThrowIfFrozen(this); }
void FreezeInternal() { attributes = FreezableHelper.FreezeListAndElements(attributes); FreezableHelper.Freeze(defaultValue); }
protected override void FreezeInternal() { FreezableHelper.Freeze(constantValue); base.FreezeInternal(); }
protected override void FreezeInternal() { base.FreezeInternal(); interfaceImplementations = FreezableHelper.FreezeList(interfaceImplementations); }
protected virtual void FreezeInternal() { attributes = FreezableHelper.FreezeListAndElements(attributes); }