예제 #1
0
        public Binder(BicepFile bicepFile, ISymbolContext symbolContext)
        {
            // TODO use lazy or some other pattern for init
            this.bicepFile   = bicepFile;
            this.TargetScope = SyntaxHelper.GetTargetScope(bicepFile);
            var(declarations, outermostScopes) = DeclarationVisitor.GetDeclarations(bicepFile, symbolContext);
            var uniqueDeclarations = GetUniqueDeclarations(declarations);
            var builtInNamespaces  = GetBuiltInNamespaces(this.TargetScope);

            this.bindings       = GetBindings(bicepFile, uniqueDeclarations, builtInNamespaces, outermostScopes);
            this.cyclesBySymbol = GetCyclesBySymbol(bicepFile, this.bindings);

            // TODO: Avoid looping 5 times?
            this.FileSymbol = new FileSymbol(
                bicepFile.FileUri.LocalPath,
                bicepFile.ProgramSyntax,
                builtInNamespaces,
                outermostScopes,
                declarations.OfType <ParameterSymbol>(),
                declarations.OfType <VariableSymbol>(),
                declarations.OfType <ResourceSymbol>(),
                declarations.OfType <ModuleSymbol>(),
                declarations.OfType <OutputSymbol>(),
                bicepFile.FileUri);
        }
예제 #2
0
파일: Binder.cs 프로젝트: yane3628/bicep
        private static ImmutableArray <DeclaredSymbol> GetAllDeclarations(SyntaxTree syntaxTree, ISymbolContext symbolContext)
        {
            // collect declarations
            var declarations       = new List <DeclaredSymbol>();
            var declarationVisitor = new DeclarationVisitor(symbolContext, declarations);

            declarationVisitor.Visit(syntaxTree.ProgramSyntax);

            return(declarations.ToImmutableArray());
        }
예제 #3
0
        public Binder(INamespaceProvider namespaceProvider, BicepFile bicepFile, ISymbolContext symbolContext)
        {
            // TODO use lazy or some other pattern for init
            this.bicepFile   = bicepFile;
            this.TargetScope = SyntaxHelper.GetTargetScope(bicepFile);
            var(declarations, outermostScopes) = DeclarationVisitor.GetDeclarations(namespaceProvider, TargetScope, bicepFile, symbolContext);
            var uniqueDeclarations = GetUniqueDeclarations(declarations);

            this.NamespaceResolver = GetNamespaceResolver(namespaceProvider, this.TargetScope, uniqueDeclarations);
            this.bindings          = NameBindingVisitor.GetBindings(bicepFile.ProgramSyntax, uniqueDeclarations, NamespaceResolver, outermostScopes);
            this.cyclesBySymbol    = GetCyclesBySymbol(bicepFile, this.bindings);

            this.FileSymbol = new FileSymbol(
                bicepFile.FileUri.LocalPath,
                bicepFile.ProgramSyntax,
                NamespaceResolver,
                outermostScopes,
                declarations,
                bicepFile.FileUri);
        }