public static GetNamingContext ( NamespaceDecl ns, SourceUnit unit ) : NamingContext | ||
ns | NamespaceDecl | Current namespace declaration. In case it is |
unit | SourceUnit | Global code used when |
return | NamingContext |
/// <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)); }
/// <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)); } }); }
/// <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)); } }); }