Exemple #1
0
            private IFileScopeInternal CreateFileScope(SyntaxNode node)
            {
                var scope = new FileScope(node, Scope);

                _scopes.Add(node, scope);
                _scopeStack.Push(scope);
                return(scope);
            }
Exemple #2
0
            public ScopeAndVariableWalker(
                Scope rootScope,
                FileScope fileScope,
                IDictionary <SyntaxNode, IVariable> variables,
                IDictionary <SyntaxNode, IScope> scopes)
                : base(SyntaxWalkerDepth.Node)
            {
                RoslynDebug.AssertNotNull(rootScope);
                RoslynDebug.AssertNotNull(fileScope);
                RoslynDebug.AssertNotNull(variables);
                RoslynDebug.AssertNotNull(scopes);

                _rootScope = rootScope;
                _fileScope = fileScope;
                _variables = variables;
                _scopes    = scopes;
                _scopeStack.Push(rootScope);
                _scopeStack.Push(fileScope);
            }
Exemple #3
0
        private static void AddTree(
            SyntaxTree tree,
            Scope rootScope,
            IDictionary <SyntaxNode, IVariable> variable,
            IDictionary <SyntaxNode, IScope> scopes,
            IDictionary <SyntaxNode, IGotoLabel> labels)
        {
            var node      = tree.GetRoot();
            var fileScope = new FileScope(node, rootScope);
            var scopesAndVariableWalker = new ScopeAndVariableWalker(
                rootScope,
                fileScope,
                variable,
                scopes);

            scopesAndVariableWalker.Visit(node);
            var labelWalker = new GotoLabelWalker(scopes, labels);

            labelWalker.Visit(node);
            var gotoWalker = new GotoWalker(scopes, labels);

            gotoWalker.Visit(node);
        }