Esempio n. 1
0
        public static void Resolve(ParserContext parser, CompilationScope scope)
        {
            Dictionary <string, TopLevelEntity>             scopeLookup         = new Dictionary <string, TopLevelEntity>();
            Dictionary <string, TopLevelEntity>             depsLookup          = new Dictionary <string, TopLevelEntity>();
            Dictionary <string, NamespaceReferenceTemplate> depsNamespaceLookup = new Dictionary <string, NamespaceReferenceTemplate>();

            // First create a lookup of JUST the libraries that are available to this library.
            // This is localized to the locales that are used by that library.
            foreach (LocalizedAssemblyView depLocView in scope.Dependencies)
            {
                depLocView.Scope.FlattenFullyQualifiedLookupsIntoGlobalLookup(depsLookup, depLocView.Locale);
                Dictionary <string, NamespaceReferenceTemplate> newNamespaces = depLocView.Scope.GetFlattenedNamespaceLookup(depLocView.Locale);
                foreach (string key in newNamespaces.Keys)
                {
                    depsNamespaceLookup[key] = newNamespaces[key];
                }
            }

            scope.FlattenFullyQualifiedLookupsIntoGlobalLookup(scopeLookup, scope.Locale);
            Dictionary <string, NamespaceReferenceTemplate> scopeNamespaceLookup = scope.GetFlattenedNamespaceLookup(scope.Locale);

            TopLevelEntity[] toResolve = scope.GetTopLevelEntities();

            ResolveNames(parser, toResolve, scopeLookup, depsLookup, scopeNamespaceLookup, depsNamespaceLookup);
        }
Esempio n. 2
0
        public static void Resolve(ParserContext parser, CompilationScope scope)
        {
            Dictionary <string, TopLevelConstruct>          scopeLookup         = new Dictionary <string, TopLevelConstruct>();
            Dictionary <string, TopLevelConstruct>          depsLookup          = new Dictionary <string, TopLevelConstruct>();
            Dictionary <string, NamespaceReferenceTemplate> depsNamespaceLookup = new Dictionary <string, NamespaceReferenceTemplate>();

            // First create a lookup of JUST the libraries that are available to this library.
            // This is localized to the locales that are used by that library.
            foreach (LocalizedLibraryView depLocView in scope.Dependencies)
            {
                depLocView.LibraryScope.FlattenFullyQualifiedLookupsIntoGlobalLookup(depsLookup, depLocView.Locale);
                Util.MergeDictionaryInto(
                    depLocView.LibraryScope.GetFlattenedNamespaceLookup(depLocView.Locale),
                    depsNamespaceLookup);
            }

            scope.FlattenFullyQualifiedLookupsIntoGlobalLookup(scopeLookup, scope.Locale);
            Dictionary <string, NamespaceReferenceTemplate> scopeNamespaceLookup = scope.GetFlattenedNamespaceLookup(scope.Locale);

            TopLevelConstruct[] toResolve = scope.GetTopLevelConstructs();

            ResolveNames(parser, toResolve, scopeLookup, depsLookup, scopeNamespaceLookup, depsNamespaceLookup);
        }