public override ITypeReference ToTypeReference(NameLookupMode lookupMode, InterningProvider interningProvider = null) { if (interningProvider == null) { interningProvider = InterningProvider.Dummy; } ITypeReference t = this.BaseType.ToTypeReference(lookupMode, interningProvider); if (this.HasNullableSpecifier) { t = interningProvider.Intern(NullableType.Create(t)); } int pointerRank = this.PointerRank; for (int i = 0; i < pointerRank; i++) { t = interningProvider.Intern(new PointerTypeReference(t)); } foreach (var a in this.ArraySpecifiers.Reverse()) { t = interningProvider.Intern(new ArrayTypeReference(t, a.Dimensions)); } if (this.HasRefSpecifier) { t = interningProvider.Intern(new ByReferenceTypeReference(t)); } return(t); }
/// <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); }
/// <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"); } ThrowIfFrozen(); name = provider.Intern(name); attributes = provider.InternList(attributes); }
public override ITypeReference ToTypeReference(NameLookupMode lookupMode, InterningProvider interningProvider = null) { if (interningProvider == null) { interningProvider = InterningProvider.Dummy; } TypeOrNamespaceReference t; if (this.IsDoubleColon) { SimpleType st = this.Target as SimpleType; if (st != null) { t = interningProvider.Intern(new AliasNamespaceReference(interningProvider.Intern(st.Identifier))); } else { t = null; } } else { t = this.Target.ToTypeReference(lookupMode, interningProvider) as TypeOrNamespaceReference; } if (t == null) { return(SpecialType.UnknownType); } var typeArguments = new List <ITypeReference>(); foreach (var ta in this.TypeArguments) { typeArguments.Add(ta.ToTypeReference(lookupMode, interningProvider)); } string memberName = interningProvider.Intern(this.MemberName); return(interningProvider.Intern(new MemberTypeOrNamespaceReference(t, memberName, interningProvider.InternList(typeArguments), lookupMode))); }
public override ITypeReference ToTypeReference(NameLookupMode lookupMode, InterningProvider interningProvider = null) { if (interningProvider == null) { interningProvider = InterningProvider.Dummy; } var typeArguments = new List <ITypeReference>(); foreach (var ta in this.TypeArguments) { typeArguments.Add(ta.ToTypeReference(lookupMode, interningProvider)); } string identifier = interningProvider.Intern(this.Identifier); if (typeArguments.Count == 0 && string.IsNullOrEmpty(identifier)) { // empty SimpleType is used for typeof(List<>). return(SpecialType.UnboundTypeArgument); } var t = new SimpleTypeOrNamespaceReference(identifier, interningProvider.InternList(typeArguments), lookupMode); return(interningProvider.Intern(t)); }
/// <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"); ThrowIfFrozen(); name = provider.Intern(name); attributes = provider.InternList(attributes); if (rareFields != null) rareFields.ApplyInterningProvider(provider); }