Exemple #1
0
 protected DeclaredSymbol(ISymbolContext context, string name, SyntaxBase declaringSyntax, IdentifierSyntax nameSyntax)
     : base(name)
 {
     this.Context         = context;
     this.DeclaringSyntax = declaringSyntax;
     this.NameSyntax      = nameSyntax;
 }
Exemple #2
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);
        }
Exemple #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);
        }
Exemple #4
0
        public Binder(SyntaxTree syntaxTree, ISymbolContext symbolContext)
        {
            // TODO use lazy or some other pattern for init
            this.syntaxTree  = syntaxTree;
            this.TargetScope = SyntaxHelper.GetTargetScope(syntaxTree);
            var allDeclarations    = GetAllDeclarations(syntaxTree, symbolContext);
            var uniqueDeclarations = GetUniqueDeclarations(allDeclarations);
            var builtInNamespacs   = GetBuiltInNamespaces(this.TargetScope);

            this.bindings       = GetBindings(syntaxTree, uniqueDeclarations, builtInNamespacs);
            this.cyclesBySymbol = GetCyclesBySymbol(syntaxTree, uniqueDeclarations, this.bindings);

            // TODO: Avoid looping 5 times?
            this.FileSymbol = new FileSymbol(
                syntaxTree.FileUri.LocalPath,
                syntaxTree.ProgramSyntax,
                builtInNamespacs,
                allDeclarations.OfType <ParameterSymbol>(),
                allDeclarations.OfType <VariableSymbol>(),
                allDeclarations.OfType <ResourceSymbol>(),
                allDeclarations.OfType <ModuleSymbol>(),
                allDeclarations.OfType <OutputSymbol>());
        }
Exemple #5
0
 public ResourceSymbol(ISymbolContext context, string name, ResourceDeclarationSyntax declaringSyntax, SyntaxBase body)
     : base(context, name, declaringSyntax, declaringSyntax.Name)
 {
     this.Body = body;
 }
 public VariableSymbol(ISymbolContext context, string name, VariableDeclarationSyntax declaringSyntax, SyntaxBase value)
     : base(context, name, declaringSyntax, declaringSyntax.Name)
 {
     this.Value = value;
 }
Exemple #7
0
 public ParameterSymbol(ISymbolContext context, string name, ParameterDeclarationSyntax declaringSyntax, SyntaxBase?modifier)
     : base(context, name, declaringSyntax, declaringSyntax.Name)
 {
     this.Modifier = modifier;
 }
Exemple #8
0
 public OutputSymbol(ISymbolContext context, string name, OutputDeclarationSyntax declaringSyntax, SyntaxBase value)
     : base(context, name, declaringSyntax, declaringSyntax.Name)
 {
     this.Value = value;
 }
Exemple #9
0
 public ResourceSymbol(ISymbolContext context, string name, ResourceDeclarationSyntax declaringSyntax)
     : base(context, name, declaringSyntax, declaringSyntax.Name)
 {
 }
Exemple #10
0
 public DeclarationVisitor(ISymbolContext context, IList <DeclaredSymbol> declaredSymbols)
 {
     this.context         = context;
     this.declaredSymbols = declaredSymbols;
 }
Exemple #11
0
        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());
        }
 public LocalVariableSymbol(ISymbolContext context, string name, LocalVariableSyntax declaringSyntax)
     : base(context, name, declaringSyntax, declaringSyntax.Name)
 {
 }
 public ImportedNamespaceSymbol(ISymbolContext context, string name, TypeSymbol declaredType, ImportDeclarationSyntax declaringSyntax)
     : base(context, name, declaringSyntax, declaringSyntax.Name)
 {
     DeclaredType = declaredType;
 }
Exemple #14
0
 public ModuleSymbol(ISymbolContext context, string name, ModuleDeclarationSyntax declaringSyntax)
     : base(context, name, declaringSyntax, declaringSyntax.Name)
 {
 }
 public LocalVariableSymbol(ISymbolContext context, string name, LocalVariableSyntax declaringSyntax, LocalKind localKind)
     : base(context, name, declaringSyntax, declaringSyntax.Name)
 {
     this.LocalKind = localKind;
 }
Exemple #16
0
 public ParameterSymbol(ISymbolContext context, string name, ParameterDeclarationSyntax declaringSyntax)
     : base(context, name, declaringSyntax, declaringSyntax.Name)
 {
 }