コード例 #1
0
 protected override void FreezeInternal()
 {
     parameters = FreezableHelper.FreezeListAndElements(parameters);
     FreezableHelper.Freeze(getter);
     FreezableHelper.Freeze(setter);
     base.FreezeInternal();
 }
コード例 #2
0
 protected override void FreezeInternal()
 {
     base.FreezeInternal();
     FreezableHelper.Freeze(addAccessor);
     FreezableHelper.Freeze(removeAccessor);
     FreezableHelper.Freeze(invokeAccessor);
 }
コード例 #3
0
 protected override void FreezeInternal()
 {
     returnTypeAttributes = FreezableHelper.FreezeListAndElements(returnTypeAttributes);
     typeParameters       = FreezableHelper.FreezeListAndElements(typeParameters);
     parameters           = FreezableHelper.FreezeListAndElements(parameters);
     base.FreezeInternal();
 }
コード例 #4
0
 protected virtual void FreezeInternal()
 {
     attributes = FreezableHelper.FreezeListAndElements(attributes);
     if (rareFields != null)
     {
         rareFields.FreezeInternal();
     }
 }
コード例 #5
0
 protected override void FreezeInternal()
 {
     base.FreezeInternal();
     baseTypes      = FreezableHelper.FreezeList(baseTypes);
     typeParameters = FreezableHelper.FreezeListAndElements(typeParameters);
     nestedTypes    = FreezableHelper.FreezeListAndElements(nestedTypes);
     members        = FreezableHelper.FreezeListAndElements(members);
 }
コード例 #6
0
 protected override void FreezeInternal()
 {
     base.FreezeInternal();
     assemblyAttributes = FreezableHelper.FreezeListAndElements(assemblyAttributes);
     moduleAttributes   = FreezableHelper.FreezeListAndElements(moduleAttributes);
     foreach (var type in typeDefinitions.Values)
     {
         FreezableHelper.Freeze(type);
     }
 }
コード例 #7
0
 /// <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);
 }
コード例 #8
0
 void SetFlag(byte flag, bool value)
 {
     FreezableHelper.ThrowIfFrozen(this);
     if (value)
     {
         this.flags |= flag;
     }
     else
     {
         this.flags &= unchecked ((byte)~flag);
     }
 }
コード例 #9
0
 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);
     }
 }
コード例 #10
0
        /// <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;
        }
コード例 #11
0
        /// <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);
        }
コード例 #12
0
        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);
            }
        }
コード例 #13
0
 void FreezeInternal()
 {
     attributes = FreezableHelper.FreezeListAndElements(attributes);
     FreezableHelper.Freeze(defaultValue);
 }
コード例 #14
0
 protected override void FreezeInternal()
 {
     base.FreezeInternal();
     interfaceImplementations = FreezableHelper.FreezeList(interfaceImplementations);
 }
コード例 #15
0
 protected override void FreezeInternal()
 {
     FreezableHelper.Freeze(constantValue);
     base.FreezeInternal();
 }
コード例 #16
0
 protected void ThrowIfFrozen()
 {
     FreezableHelper.ThrowIfFrozen(this);
 }
コード例 #17
0
 protected virtual void FreezeInternal()
 {
     attributes = FreezableHelper.FreezeListAndElements(attributes);
 }