Esempio n. 1
0
 private static FunctionDefinition[] FindFunctionImpl(ParserContext parser, CompilationScope scope, string name)
 {
     return(scope.GetTopLevelConstructs()
            .OfType <FunctionDefinition>()
            .Where(fd => fd.NameToken.Value == name)
            .ToArray());
 }
Esempio n. 2
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);
                CommonUtil.Collections.DictionaryUtil.MergeDictionaryInto(
                    depLocView.Scope.GetFlattenedNamespaceLookup(depLocView.Locale),
                    depsNamespaceLookup);
            }

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

            TopLevelEntity[] toResolve = scope.GetTopLevelConstructs();

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