GetNamingContext() публичный статический Метод

Create naming context.
public static GetNamingContext ( NamespaceDecl ns, SourceUnit unit ) : NamingContext
ns NamespaceDecl Current namespace declaration. In case it is null, context for global code is created.
unit SourceUnit Global code used when is null.
Результат NamingContext
Пример #1
0
        /// <summary>
        /// Creates type context for a method within given type, determines naming, type context.
        /// </summary>
        public static TypeRefContext /*!*/ CreateTypeRefContext(SourceNamedTypeSymbol /*!*/ containingType)
        {
            Contract.ThrowIfNull(containingType);

            var typeDecl = containingType.Syntax;

            return(new TypeRefContext(NameUtils.GetNamingContext(typeDecl), typeDecl.SourceUnit, containingType));
        }
Пример #2
0
 /// <summary>
 /// Enqueues initializers of a class fields and constants.
 /// </summary>
 void EnqueueFieldsInitializer(SourceTypeSymbol type)
 {
     type.GetDeclaredMembers().OfType <SourceFieldSymbol>().Foreach(f =>
     {
         if (f.Initializer != null)
         {
             EnqueueExpression(
                 f.Initializer,
                 TypeRefFactory.CreateTypeRefContext(type), //the context will be lost, analysis resolves constant values only and types are temporary
                 NameUtils.GetNamingContext(type.Syntax));
         }
     });
 }
Пример #3
0
 /// <summary>
 /// Enqueues initializers of a class fields and constants.
 /// </summary>
 void EnqueueFieldsInitializer(SourceTypeSymbol type)
 {
     type.GetDeclaredMembers().OfType <SourceFieldSymbol>().ForEach(f =>
     {
         if (f.Initializer != null)
         {
             EnqueueExpression(
                 f.Initializer,
                 f.EnsureTypeRefContext(),
                 NameUtils.GetNamingContext(type.Syntax));
         }
     });
 }