示例#1
0
 public BoundNamespaceExpression(SyntaxNode syntax, NamespaceSymbol namespaceSymbol, bool hasErrors = false)
     : this(syntax, namespaceSymbol, null, hasErrors)
 {
 }
示例#2
0
 public BoundNamespaceExpression Update(NamespaceSymbol namespaceSymbol)
 {
     return(Update(namespaceSymbol, this.AliasOpt));
 }
示例#3
0
 public override void VisitNamespace(NamespaceSymbol @namespace)
 {
     VisitList(@namespace.GetMembers());
 }
示例#4
0
 private static void GetTopLevelTypes(ArrayBuilder <Cci.INamespaceTypeDefinition> builder, NamespaceSymbol @namespace)
 {
     foreach (var member in @namespace.GetMembers())
     {
         if (member.Kind == SymbolKind.Namespace)
         {
             GetTopLevelTypes(builder, (NamespaceSymbol)member);
         }
         else
         {
             builder.Add((Cci.INamespaceTypeDefinition)member);
         }
     }
 }
        public static void FindCandidatesInNamespace(NamespaceSymbol root, ArrayBuilder <MethodSymbol> entryPointCandidates, CancellationToken cancellationToken)
        {
            EntryPointCandidateFinder finder = new EntryPointCandidateFinder(entryPointCandidates, visitNestedTypes: true, cancellationToken: cancellationToken);

            finder.Visit(root);
        }
示例#6
0
        private void ImportType(MetadataSource mdSource, TypeDefinition type, bool inScriptCoreAssembly,
                                ScriptReference dependency, TypeSymbol outerType = null)
        {
            if (!type.IsPublic && !type.IsNestedPublic)
            {
                return;
            }

            if (inScriptCoreAssembly && MetadataHelpers.ShouldImportScriptCoreType(type) == false)
            {
                return;
            }

            string name          = outerType is TypeSymbol ? $"{outerType.Name}${type.Name}" : type.Name;
            string namespaceName = outerType is TypeSymbol ? outerType.Namespace : type.Namespace;

            bool   dummy;
            string scriptName = MetadataHelpers.GetScriptName(type, out dummy, out dummy);

            NamespaceSymbol namespaceSymbol = symbols.GetNamespace(namespaceName);
            TypeSymbol      typeSymbol      = null;

            if (type.IsInterface)
            {
                typeSymbol = new InterfaceSymbol(name, namespaceSymbol);
            }
            else if (MetadataHelpers.IsEnum(type))
            {
                // NOTE: We don't care about the flags bit on imported enums
                //       because this is only consumed by the generation logic.
                typeSymbol = new EnumerationSymbol(name, namespaceSymbol, /* flags */ false);

                if (MetadataHelpers.ShouldUseEnumNames(type))
                {
                    ((EnumerationSymbol)typeSymbol).SetNamedValues();
                }
                else if (MetadataHelpers.ShouldUseEnumValues(type))
                {
                    ((EnumerationSymbol)typeSymbol).SetNumericValues();
                }
            }
            else if (MetadataHelpers.IsDelegate(type))
            {
                typeSymbol = new DelegateSymbol(name, namespaceSymbol);
                typeSymbol.SetTransformedName("Function");
            }
            else
            {
                if (MetadataHelpers.ShouldTreatAsRecordType(type))
                {
                    typeSymbol = new RecordSymbol(name, namespaceSymbol);
                    typeSymbol.SetTransformedName(nameof(Object));
                }
                else
                {
                    typeSymbol = new ClassSymbol(name, namespaceSymbol);
                }
            }

            if (typeSymbol != null)
            {
                if (type.HasGenericParameters)
                {
                    List <GenericParameterSymbol> genericArguments = new List <GenericParameterSymbol>();

                    foreach (GenericParameter genericParameter in type.GenericParameters)
                    {
                        GenericParameterSymbol arg =
                            new GenericParameterSymbol(genericParameter.Position, genericParameter.Name, true, symbols.GlobalNamespace);

                        genericArguments.Add(arg);
                    }

                    typeSymbol.AddGenericParameters(genericArguments);
                }

                string dependencyName = MetadataHelpers.GetScriptDependencyName(type, out string dependencyIdentifier);

                if (dependencyName != null)
                {
                    dependency = ScriptReferenceProvider.Instance.GetReference(dependencyName, dependencyIdentifier);
                }

                typeSymbol.SetImported(dependency);
                typeSymbol.SetMetadataToken(type, inScriptCoreAssembly);

                bool ignoreNamespace = MetadataHelpers.ShouldIgnoreNamespace(type);

                if (ignoreNamespace || dependency == null || string.IsNullOrEmpty(dependency.Identifier))
                {
                    typeSymbol.SetIgnoreNamespace();
                }
                else
                {
                    typeSymbol.ScriptNamespace = dependency.Identifier;
                }

                typeSymbol.IsPublic = true;

                if (string.IsNullOrEmpty(scriptName) == false)
                {
                    typeSymbol.SetTransformedName(scriptName);
                }

                SetArrayTypeMetadata(type, typeSymbol, scriptName);

                typeSymbol.SetSource(dependency);
                namespaceSymbol.AddType(typeSymbol);
                importedTypes.Add(typeSymbol);

                if (outerType is TypeSymbol)
                {
                    outerType.AddType(typeSymbol);
                }

                if (type.HasNestedTypes)
                {
                    foreach (TypeDefinition nestedType in type.NestedTypes)
                    {
                        ImportType(mdSource, nestedType, inScriptCoreAssembly, dependency, typeSymbol);
                    }
                }
            }
        }
示例#7
0
 /// <summary>
 /// Called when visiting a <see cref="NamespaceSymbol" />; Should override this method if
 /// want to visit members of the namespace; Calling <see
 /// cref="NamespaceOrTypeSymbol.GetMembers()" />
 /// and loop over each member; calling <see cref="Visit" /> on it Or override this with
 /// specific implementation; Calling <see cref="DefaultVisit" /> if it's not
 /// overridden
 /// </summary>
 /// <param name="symbol">The visited symbol</param>
 /// <param name="argument">Additional argument</param>
 /// <returns></returns>
 public virtual TResult VisitNamespace(NamespaceSymbol symbol, TArgument argument)
 {
     return(DefaultVisit(symbol, argument));
 }
示例#8
0
 public virtual TResult VisitNamespace(NamespaceSymbol symbol)
 {
     return(DefaultVisit(symbol));
 }
示例#9
0
 private SynthesizedEmbeddedAttributeSymbol CreateParameterlessEmbeddedAttributeSymbol(string name, NamespaceSymbol containingNamespace, BindingDiagnosticBag diagnostics)
 => new SynthesizedEmbeddedAttributeSymbol(
     name,
     containingNamespace,
     SourceModule,
     baseType: GetWellKnownType(WellKnownType.System_Attribute, diagnostics));
示例#10
0
 private SynthesizedEmbeddedNativeIntegerAttributeSymbol CreateNativeIntegerAttributeSymbol(string name, NamespaceSymbol containingNamespace, BindingDiagnosticBag diagnostics)
 => new SynthesizedEmbeddedNativeIntegerAttributeSymbol(
     name,
     containingNamespace,
     SourceModule,
     GetWellKnownType(WellKnownType.System_Attribute, diagnostics),
     GetSpecialType(SpecialType.System_Boolean, diagnostics));
示例#11
0
 public GenericParameterSymbol(int index, string name, bool typeParameter, NamespaceSymbol parent)
     : base(SymbolType.GenericParameter, name, parent)
 {
     Index           = index;
     IsTypeParameter = typeParameter;
 }
        public MethodDocumentationCommentTests()
        {
            _compilation = CreateCompilationWithMscorlib40AndDocumentationComments(@"namespace Acme
{
    struct ValueType
    {
        public void M(int i) { }

        public static explicit operator ValueType (byte value)
        {
            return default(ValueType);
        }
    }
    class Widget: IProcess
    {
        public class NestedClass
        {
            public void M(int i) { }
        }

        /// <summary>M0 Summary.</summary>
        public static void M0() { }
        public void M1(char c, out float f, ref ValueType v) { }
        public void M2(short[] x1, int[,] x2, long[][] x3) { }
        public void M3(long[][] x3, Widget[][,,] x4) { }
        public unsafe void M4(char *pc, Color **pf) { }
        public unsafe void M5(void *pv, double *[][,] pd) { }
        public void M6(int i, params object[] args) { }
        public void M7((int x1, int x2, int x3, int x4, int x5, int x6, short x7) z) { }
        public void M8((int x1, int x2, int x3, int x4, int x5, int x6, short x7, int x8) z) { }
        public void M9((int x1, int x2, int x3, int x4, int x5, int x6, short x7, (string y1, string y2)) z) { }
        public void M10((int x1, short x2) y, System.Tuple<int, short> z) { }
        public unsafe void M11(delegate* <void> funcPtr) {}
        public unsafe void M12(delegate* <int, void> funcPtr) {}
        public unsafe void M13(delegate* <int, int> funcPtr) {}
        public unsafe void M14(delegate* managed<void> funcPtr) {}
        public unsafe void M15(delegate* managed<int, void> funcPtr) {}
        public unsafe void M16(delegate* managed<int, int> funcPtr) {}
        public unsafe void M17(delegate* unmanaged<void> funcPtr) {}
        public unsafe void M18(delegate* unmanaged[Cdecl]<void> funcPtr) {}
        public unsafe void M19(delegate* unmanaged[Stdcall]<void> funcPtr) {}
        public unsafe void M20(delegate* unmanaged[Thiscall]<void> funcPtr) {}
        public unsafe void M21(delegate* unmanaged[Fastcall]<void> funcPtr) {}
        public unsafe void M22(delegate* unmanaged[Cdecl,SuppressGCTransition]<void> funcPtr) {}
        public unsafe void M23(delegate* unmanaged[Stdcall,SuppressGCTransition]<void> funcPtr) {}
        public unsafe void M24(delegate* unmanaged[Thiscall,SuppressGCTransition]<void> funcPtr) {}
        public unsafe void M25(delegate* unmanaged[Fastcall,SuppressGCTransition]<void> funcPtr) {}
    }
    class MyList<T>
    {
        public void Test(T t) { }
        public void Zip(MyList<T> other) { }
        public void ReallyZip(MyList<MyList<T>> other) { }
    }
    class UseList
    {
        public void Process(MyList<int> list) { }
        public MyList<T> GetValues<T>(T inputValue) { return null; }
    }
}
");

            _acmeNamespace = (NamespaceSymbol)_compilation.GlobalNamespace.GetMembers("Acme").Single();
            _widgetClass   = _acmeNamespace.GetTypeMembers("Widget").Single();
        }
示例#13
0
 private SynthesizedEmbeddedNullablePublicOnlyAttributeSymbol CreateNullablePublicOnlyAttributeSymbol(string name, NamespaceSymbol containingNamespace, DiagnosticBag diagnostics)
 => new SynthesizedEmbeddedNullablePublicOnlyAttributeSymbol(
     name,
     containingNamespace,
     SourceModule,
     GetWellKnownType(WellKnownType.System_Attribute, diagnostics),
     GetSpecialType(SpecialType.System_Boolean, diagnostics));
示例#14
0
        public void AccessCheckApi1()
        {
            CSharpCompilation c              = CreateCompilationWithMscorlib(@"
using System.Collections.Generic;
class A
{
    static private int priv;
    static public int pub;
    protected int prot;
    static private Foo unknowntype;
    
    private class K {}

    private K[] karray;
    private A[] aarray;
    private IEnumerable<K> kenum;
    private IEnumerable<A> aenum;
}

class B
{}

class ADerived: A
{}

class ADerived2: A
{}
");
            NamespaceSymbol   globalNS       = c.GlobalNamespace;
            AssemblySymbol    sourceAssem    = c.SourceModule.ContainingAssembly;
            AssemblySymbol    mscorlibAssem  = c.GetReferencedAssemblySymbol(c.ExternalReferences[0]);
            NamedTypeSymbol   classA         = globalNS.GetMembers("A").Single() as NamedTypeSymbol;
            NamedTypeSymbol   classADerived  = globalNS.GetMembers("ADerived").Single() as NamedTypeSymbol;
            NamedTypeSymbol   classADerived2 = globalNS.GetMembers("ADerived2").Single() as NamedTypeSymbol;
            NamedTypeSymbol   classB         = globalNS.GetMembers("B").Single() as NamedTypeSymbol;
            NamedTypeSymbol   classK         = classA.GetMembers("K").Single() as NamedTypeSymbol;
            FieldSymbol       privField      = classA.GetMembers("priv").Single() as FieldSymbol;
            FieldSymbol       pubField       = classA.GetMembers("pub").Single() as FieldSymbol;
            FieldSymbol       protField      = classA.GetMembers("prot").Single() as FieldSymbol;
            TypeSymbol        karrayType     = (classA.GetMembers("karray").Single() as FieldSymbol).Type;
            TypeSymbol        aarrayType     = (classA.GetMembers("aarray").Single() as FieldSymbol).Type;
            TypeSymbol        kenumType      = (classA.GetMembers("kenum").Single() as FieldSymbol).Type;
            TypeSymbol        aenumType      = (classA.GetMembers("aenum").Single() as FieldSymbol).Type;
            TypeSymbol        unknownType    = (classA.GetMembers("unknowntype").Single() as FieldSymbol).Type;
            var semanticModel = c.GetSemanticModel(c.SyntaxTrees[0]);

            Assert.True(Symbol.IsSymbolAccessible(classA, classB));
            Assert.True(Symbol.IsSymbolAccessible(pubField, classB));
            Assert.False(Symbol.IsSymbolAccessible(privField, classB));
            Assert.False(Symbol.IsSymbolAccessible(karrayType, classB));
            Assert.True(Symbol.IsSymbolAccessible(aarrayType, classB));
            Assert.False(Symbol.IsSymbolAccessible(kenumType, classB));
            Assert.True(Symbol.IsSymbolAccessible(aenumType, classB));
            Assert.True(Symbol.IsSymbolAccessible(unknownType, classB));
            Assert.True(Symbol.IsSymbolAccessible(globalNS, classB));
            Assert.True(Symbol.IsSymbolAccessible(protField, classA));
            Assert.True(Symbol.IsSymbolAccessible(protField, classA, classADerived));
            Assert.False(Symbol.IsSymbolAccessible(protField, classB));
            Assert.False(Symbol.IsSymbolAccessible(protField, classB, classADerived));
            Assert.True(Symbol.IsSymbolAccessible(protField, classA));
            Assert.True(Symbol.IsSymbolAccessible(protField, classADerived, classADerived));
            Assert.False(Symbol.IsSymbolAccessible(protField, classADerived, classADerived2));

            Assert.True(Symbol.IsSymbolAccessible(classA, sourceAssem));
            Assert.True(Symbol.IsSymbolAccessible(aarrayType, sourceAssem));
            Assert.False(Symbol.IsSymbolAccessible(karrayType, sourceAssem));
            Assert.False(Symbol.IsSymbolAccessible(classA, mscorlibAssem));
            Assert.True(Symbol.IsSymbolAccessible(unknownType, sourceAssem));
            Assert.True(Symbol.IsSymbolAccessible(mscorlibAssem, sourceAssem));
        }
示例#15
0
        public void PresentCorLib()
        {
            var assemblies = MetadataTestHelpers.GetSymbolsForReferences(new[] { NetCoreApp.SystemRuntime });

            MetadataOrSourceAssemblySymbol msCorLibRef = (MetadataOrSourceAssemblySymbol)assemblies[0];

            var knownMissingTypes = new HashSet <int>()
            {
            };

            for (int i = 1; i <= (int)SpecialType.Count; i++)
            {
                var t = msCorLibRef.GetSpecialType((SpecialType)i);
                Assert.Equal((SpecialType)i, t.SpecialType);
                Assert.Same(msCorLibRef, t.ContainingAssembly);
                if (knownMissingTypes.Contains(i))
                {
                    // not present on dotnet core 3.1
                    Assert.Equal(TypeKind.Error, t.TypeKind);
                }
                else
                {
                    Assert.NotEqual(TypeKind.Error, t.TypeKind);
                }
            }

            Assert.False(msCorLibRef.KeepLookingForDeclaredSpecialTypes);

            assemblies = MetadataTestHelpers.GetSymbolsForReferences(mrefs: new[] { MetadataReference.CreateFromImage(Net50.Resources.SystemRuntime) });

            msCorLibRef = (MetadataOrSourceAssemblySymbol)assemblies[0];
            Assert.True(msCorLibRef.KeepLookingForDeclaredSpecialTypes);

            Queue <NamespaceSymbol> namespaces = new Queue <NamespaceSymbol>();

            namespaces.Enqueue(msCorLibRef.Modules[0].GlobalNamespace);
            int count = 0;

            while (namespaces.Count > 0)
            {
                foreach (var m in namespaces.Dequeue().GetMembers())
                {
                    NamespaceSymbol ns = m as NamespaceSymbol;

                    if (ns != null)
                    {
                        namespaces.Enqueue(ns);
                    }
                    else if (((NamedTypeSymbol)m).SpecialType != SpecialType.None)
                    {
                        count++;
                    }

                    if (count >= (int)SpecialType.Count)
                    {
                        Assert.False(msCorLibRef.KeepLookingForDeclaredSpecialTypes);
                    }
                }
            }

            Assert.Equal((int)SpecialType.Count, count + knownMissingTypes.Count);
            Assert.Equal(knownMissingTypes.Any(), msCorLibRef.KeepLookingForDeclaredSpecialTypes);
        }
示例#16
0
 public void SetContainer(Symbol container)
 {
     this.container = (NamespaceSymbol)container;
 }
        private LookupResult MemberLookupInNamespace(NamespaceSymbol ns, string name, int arity)
        {
            LookupResult result = new LookupResult();

            IEnumerable<Symbol> members = ns.GetMembers(name);
            foreach (Symbol member in members) {
                LookupResult resultOfThisMember;
                DiagnosticInfo diagInfo;

                if (WrongArity(member, arity, out diagInfo))
                    resultOfThisMember = LookupResult.WrongArity(member, diagInfo);
                else if (!IsMemberAccessible(member))
                    resultOfThisMember = LookupResult.Inaccessible(member);
                else
                    resultOfThisMember = LookupResult.Good(member);

                result = MergeLookupsInSameScope(result, resultOfThisMember);
            }

            return result;
        }
示例#18
0
        public void TestMergedNamespaces()
        {
            NamespaceSymbol root1 = (NamespaceSymbol)CreateMockSymbol(new NamespaceExtent(new MockAssemblySymbol("Assem1")),
                                                                      XElement.Parse(
                                                                          @"<ns name=''> 
    <ns name='A'> 
         <ns name='D'/>
         <ns name='E'/>
         <ns name='F'>
             <ns name='G'/>
         </ns>
    </ns> 
    <ns name='B'/>
    <ns name='C'/>
    <ns name='U'/>
    <class name='X'/>
</ns>"));

            NamespaceSymbol root2 = (NamespaceSymbol)CreateMockSymbol(new NamespaceExtent(new MockAssemblySymbol("Assem2")),
                                                                      XElement.Parse(
                                                                          @"<ns name=''>
    <ns name='B'>
         <ns name='K'/>
    </ns>
    <ns name='C'/>
    <class name='X'/>
    <class name='Y'/>
</ns>"));

            NamespaceSymbol root3 = (NamespaceSymbol)CreateMockSymbol(new NamespaceExtent(new MockAssemblySymbol("Assem3")),
                                                                      XElement.Parse(
                                                                          @"<ns name=''> 
    <ns name='A'>
        <ns name='D'/>
        <ns name='E'>
           <ns name='H'/>
        </ns>
    </ns> 
    <ns name='B'>
        <ns name='K'>
            <ns name='L'/>
            <class name='L'/>
        </ns>
    </ns> 
    <class name='Z'/>
</ns>"));

            NamespaceSymbol merged = MergedNamespaceSymbol.Create(new NamespaceExtent(new MockAssemblySymbol("Merged")), null,
                                                                  new NamespaceSymbol[] { root1, root2, root3 }.AsImmutable());
            string expected =
                @"namespace  [Assembly: Merged] { 
    namespace A [Assembly: Merged] { 
        namespace D [Assembly: Merged]
        namespace E [Assembly: Merged] { 
            namespace H [Assembly: Assem3]
        }
        namespace F [Assembly: Assem1] { 
            namespace G [Assembly: Assem1]
        }
    }
    namespace B [Assembly: Merged] { 
        namespace K [Assembly: Merged] { 
            class L
            namespace L [Assembly: Assem3]
        }
    }
    namespace C [Assembly: Merged]
    namespace U [Assembly: Assem1]
    class X
    class X
    class Y
    class Z
}".Replace("Assembly: Merged", "Assembly: Merged, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")
                .Replace("Assembly: Assem1", "Assembly: Assem1, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")
                .Replace("Assembly: Assem3", "Assembly: Assem3, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null");

            Assert.Equal(expected, DumpSymbol(merged));

            NamespaceSymbol merged2 = MergedNamespaceSymbol.Create(new NamespaceExtent(new MockAssemblySymbol("Merged2")), null,
                                                                   new NamespaceSymbol[] { root1 }.AsImmutable());

            Assert.Same(merged2, root1);
        }
示例#19
0
 public override bool VisitNamespace(NamespaceSymbol symbol)
 {
     return(VisitList(symbol.GetMembers()));
 }
示例#20
0
        internal static NamespaceSymbol ExpandPreviousSubmissionNamespace(NamespaceSymbol originalNamespace, NamespaceSymbol expandedGlobalNamespace)
        {
            // Soft assert: we'll still do the right thing if it fails.
            Debug.Assert(!originalNamespace.IsGlobalNamespace, "Global using to global namespace");

            // Hard assert: we depend on this.
            Debug.Assert(expandedGlobalNamespace.IsGlobalNamespace, "Global namespace required");

            var nameParts = ArrayBuilder <string> .GetInstance();

            var curr = originalNamespace;

            while (!curr.IsGlobalNamespace)
            {
                nameParts.Add(curr.Name);
                curr = curr.ContainingNamespace;
            }

            var expandedNamespace = expandedGlobalNamespace;

            for (int i = nameParts.Count - 1; i >= 0; i--)
            {
                // Note, the name may have become ambiguous (e.g. if a type with the same name
                // is now in scope), but we're not rebinding - we're just expanding to the
                // current contents of the same namespace.
                expandedNamespace = expandedNamespace.GetMembers(nameParts[i]).OfType <NamespaceSymbol>().Single();
            }
            nameParts.Free();

            return(expandedNamespace);
        }
示例#21
0
 // local function
 static object[] CreateRow(NamespaceSymbol @namespace) => new object[]
 {
     @namespace
 };
 private bool AreNamespacesEqual(NamespaceSymbol @namespace, NamespaceSymbol other)
 {
     Debug.Assert(StringOrdinalComparer.Equals(@namespace.MetadataName, other.MetadataName));
     return(true);
 }
示例#23
0
        private static void AppendNamespace(this ICollection <SymbolMarkupToken> markup, NamespaceSymbol symbol, SymbolDisplayFormat format)
        {
            if (format == SymbolDisplayFormat.QuickInfo)
            {
                markup.AppendKeyword("namespace");
                markup.AppendSpace();

                if (symbol.Parent != null)
                {
                    markup.AppendParentScope(symbol.Parent);
                }
            }

            markup.AppendName(SymbolMarkupKind.NamespaceName, symbol.Name);
        }
示例#24
0
 public RecordSymbol(string name, NamespaceSymbol parent)
     : base(SymbolType.Record, name, parent)
 {
 }
示例#25
0
 // For the purposes of SemanticModel, it is convenient to have an AliasSymbol for the "global" namespace that "global::" binds
 // to. This alias symbol is returned only when binding "global::" (special case code).
 internal static AliasSymbol CreateGlobalNamespaceAlias(NamespaceSymbol globalNamespace, Binder globalNamespaceBinder)
 {
     return(new AliasSymbol(globalNamespaceBinder, globalNamespace, "global", ImmutableArray <Location> .Empty));
 }
示例#26
0
 public virtual void VisitNamespace(NamespaceSymbol symbol)
 {
     DefaultVisit(symbol);
 }
 public NamespaceBinder(SharedBinderState sharedBinderState, Binder parent, NamespaceSymbol namespaceSymbol)
     : base(sharedBinderState, parent)
 {
     NamespaceSymbol = namespaceSymbol;
 }
示例#28
0
 public BoundNamespaceExpression(SyntaxNode syntax, NamespaceSymbol namespaceSymbol)
     : this(syntax, namespaceSymbol, null)
 {
 }
示例#29
0
 internal NamespaceSymbol(string name, NamespaceSymbol parent)
 {
     Name = name; ParentNamespace = parent;
 }
示例#30
0
 public static NamedTypeSymbol ChildType(this NamespaceSymbol ns, string name, int arity)
 {
     return(ns.GetMembers()
            .OfType <NamedTypeSymbol>()
            .Single(n => n.Name.Equals(name) && n.Arity == arity));
 }
示例#31
0
 internal NamespaceSymbol()
 {
     Name = null; ParentNamespace = null;
 }
示例#32
0
        private static void AppendNamespace(this ICollection<SymbolMarkupToken> markup, NamespaceSymbol symbol)
        {
            markup.AppendKeyword("namespace");
            markup.AppendSpace();

            if (symbol.Parent != null)
                markup.AppendParentScope(symbol.Parent);

            markup.AppendName(SymbolMarkupKind.NamespaceName, symbol.Name);
        }
 public static object GetErrorReportingName(NamespaceSymbol @namespace)
 {
     return @namespace.IsGlobalNamespace ?
         MessageID.IDS_GlobalNamespace.Localize() :
         (object) @namespace.GetFullName();
 }