public static SourceLocalSymbol MakeForeachLocal( MethodSymbol containingMethod, ForEachLoopBinder binder, TypeSyntax typeSyntax, SyntaxToken identifierToken, ExpressionSyntax collection) { return(new ForEachLocalSymbol(containingMethod, binder, typeSyntax, identifierToken, collection, LocalDeclarationKind.ForEachIterationVariable)); }
public static SourceLocalSymbol MakeForeachLocal( MethodSymbol containingMethod, ForEachLoopBinder binder, TypeSyntax typeSyntax, SyntaxToken identifierToken, ExpressionSyntax collection) { return new SourceLocalSymbol(containingMethod, binder, typeSyntax, identifierToken, null, collection, LocalDeclarationKind.ForEach); }
public ForEachLocalSymbol( Symbol containingSymbol, ForEachLoopBinder scopeBinder, TypeSyntax typeSyntax, SyntaxToken identifierToken, ExpressionSyntax collection, LocalDeclarationKind declarationKind) : base(containingSymbol, scopeBinder, false, typeSyntax, identifierToken, declarationKind) { Debug.Assert(declarationKind == LocalDeclarationKind.ForEachIterationVariable); _collection = collection; }
public ForEachLocalSymbol( Symbol containingSymbol, ForEachLoopBinder scopeBinder, TypeSyntax typeSyntax, SyntaxToken identifierToken, ExpressionSyntax collection, LocalDeclarationKind declarationKind) : base(containingSymbol, scopeBinder, allowRefKind: true, typeSyntax, identifierToken, declarationKind, hasScopedModifier: false) // https://github.com/dotnet/roslyn/issues/62039: Allow 'scoped' modifier. { Debug.Assert(declarationKind == LocalDeclarationKind.ForEachIterationVariable); _collection = collection; }
public override void VisitForStatement(ForStatementSyntax node) { Debug.Assert((object)_containingMemberOrLambda == _enclosing.ContainingMemberOrLambda); var patternBinder = new ExpressionVariableBinder(node.Expression, _enclosing); AddToMap(node.Expression, patternBinder); Visit(node.Expression, patternBinder); var binder = new ForEachLoopBinder(patternBinder, node); AddToMap(node, binder); VisitPossibleEmbeddedStatement(node.Statement, binder); }