override protected ImmutableArray<LocalSymbol> BuildLocals()
        {
            SourceLocalSymbol local = null;

            var declarationOpt = syntax.Declaration;
            if ((declarationOpt != null) && (declarationOpt.Identifier.CSharpKind() != SyntaxKind.None))
            {
                local = SourceLocalSymbol.MakeLocal(this.ContainingMemberOrLambda, this, declarationOpt.Type, declarationOpt.Identifier, LocalDeclarationKind.CatchVariable);
            }

            if (syntax.Filter != null)
            {
                var walker = new BuildLocalsFromDeclarationsWalker(this.GetBinder(syntax.Filter), syntax.Filter);

                walker.Visit(syntax.Filter);

                if (walker.Locals != null)
                {
                    if ((object)local != null)
                    {
                        walker.Locals.Insert(0, local);
                    }

                    return walker.Locals.ToImmutableAndFree();
                }
            }

            if ((object)local != null)
            {
                return ImmutableArray.Create<LocalSymbol>(local);
            }

            return ImmutableArray<LocalSymbol>.Empty;
        }
Пример #2
0
        override protected ImmutableArray <LocalSymbol> BuildLocals()
        {
            SourceLocalSymbol local = null;

            var declarationOpt = syntax.Declaration;

            if ((declarationOpt != null) && (declarationOpt.Identifier.CSharpKind() != SyntaxKind.None))
            {
                local = SourceLocalSymbol.MakeLocal(this.ContainingMemberOrLambda, this, declarationOpt.Type, declarationOpt.Identifier, null, LocalDeclarationKind.Catch);
            }

            if (syntax.Filter != null)
            {
                var walker = new BuildLocalsFromDeclarationsWalker(this);

                walker.Visit(syntax.Filter);

                if (walker.Locals != null)
                {
                    if ((object)local != null)
                    {
                        walker.Locals.Insert(0, local);
                    }

                    return(walker.Locals.ToImmutableAndFree());
                }
            }

            if ((object)local != null)
            {
                return(ImmutableArray.Create <LocalSymbol>(local));
            }

            return(ImmutableArray <LocalSymbol> .Empty);
        }
        protected override ImmutableArray<LocalSymbol> BuildLocals()
        {
            var walker = new BuildLocalsFromDeclarationsWalker(this, initializerArgumentList);

            walker.Visit(initializerArgumentList);

            if (walker.Locals != null)
            {
                return walker.Locals.ToImmutableAndFree();
            }

            return ImmutableArray<LocalSymbol>.Empty;
        }
        protected override ImmutableArray <LocalSymbol> BuildLocals()
        {
            var walker = new BuildLocalsFromDeclarationsWalker(this);

            walker.Visit(initializerArgumentList);

            if (walker.Locals != null)
            {
                return(walker.Locals.ToImmutableAndFree());
            }

            return(ImmutableArray <LocalSymbol> .Empty);
        }
Пример #5
0
        protected override ImmutableArray<LocalSymbol> BuildLocals()
        {
            var walker = new BuildLocalsFromDeclarationsWalker(this, expression);

            walker.Visit(expression);

            if (walker.Locals != null)
            {
                return walker.Locals.ToImmutableAndFree();
            }

            return ImmutableArray<LocalSymbol>.Empty;
        }
Пример #6
0
        protected override ImmutableArray <LocalSymbol> BuildLocals()
        {
            var walker = new BuildLocalsFromDeclarationsWalker(this, expression);

            walker.Visit(expression);

            if (walker.Locals != null)
            {
                return(walker.Locals.ToImmutableAndFree());
            }

            return(ImmutableArray <LocalSymbol> .Empty);
        }
Пример #7
0
        protected ImmutableArray <LocalSymbol> BuildLocals(StatementSyntax stmt, bool isRoot = true)
        {
            Debug.Assert(stmt != null);
            var walker = new BuildLocalsFromDeclarationsWalker(this, isRoot ? stmt : null);

            walker.Visit(stmt);

            if (walker.Locals != null)
            {
                return(walker.Locals.ToImmutableAndFree());
            }

            return(ImmutableArray <LocalSymbol> .Empty);
        }
Пример #8
0
        protected ImmutableArray <LocalSymbol> BuildLocals(CSharpSyntaxNode node)
        {
            Debug.Assert(node != null);
            var walker = new BuildLocalsFromDeclarationsWalker(this, node);

            walker.Visit(node);

            if (walker.Locals != null)
            {
                return(walker.Locals.ToImmutableAndFree());
            }

            return(ImmutableArray <LocalSymbol> .Empty);
        }
Пример #9
0
        protected ImmutableArray <LocalSymbol> BuildLocals(SyntaxList <StatementSyntax> statements)
        {
            var walker = new BuildLocalsFromDeclarationsWalker(this);

            foreach (var statement in statements)
            {
                walker.Visit(statement);
            }

            if (walker.Locals != null)
            {
                return(walker.Locals.ToImmutableAndFree());
            }

            return(ImmutableArray <LocalSymbol> .Empty);
        }
Пример #10
0
        protected override ImmutableArray <LocalSymbol> BuildLocals()
        {
            var walker = new BuildLocalsFromDeclarationsWalker(this);

            walker.Visit(syntax.Declaration);

            foreach (var initializer in syntax.Initializers)
            {
                walker.Visit(initializer);
            }

            if (walker.Locals != null)
            {
                return(walker.Locals.ToImmutableAndFree());
            }

            return(ImmutableArray <LocalSymbol> .Empty);
        }
Пример #11
0
        override protected ImmutableArray<LocalSymbol> BuildLocals()
        {
            var walker = new BuildLocalsFromDeclarationsWalker(this, null);

            walker.ScopeSegmentRoot = syntax.Condition;
            walker.Visit(syntax.Condition);

            foreach (var incrementor in syntax.Incrementors)
            {
                walker.ScopeSegmentRoot = incrementor;
                walker.Visit(incrementor);
            }

            walker.ScopeSegmentRoot = null;

            if (walker.Locals != null)
            {
                return walker.Locals.ToImmutableAndFree();
            }

            return ImmutableArray<LocalSymbol>.Empty;
        }
Пример #12
0
        override protected ImmutableArray <LocalSymbol> BuildLocals()
        {
            var walker = new BuildLocalsFromDeclarationsWalker(this, null);

            walker.ScopeSegmentRoot = syntax.Condition;
            walker.Visit(syntax.Condition);

            foreach (var incrementor in syntax.Incrementors)
            {
                walker.ScopeSegmentRoot = incrementor;
                walker.Visit(incrementor);
            }

            walker.ScopeSegmentRoot = null;

            if (walker.Locals != null)
            {
                return(walker.Locals.ToImmutableAndFree());
            }

            return(ImmutableArray <LocalSymbol> .Empty);
        }