Beispiel #1
0
            public override void VisitNumericForStatement(NumericForStatementSyntax node)
            {
                Visit(node.InitialValue);
                Visit(node.FinalValue);
                if (node.StepValue is not null)
                {
                    Visit(node.StepValue);
                }

                var scope = CreateBlockScope(node);

                try
                {
                    if (node.Identifier.IsMissing || string.IsNullOrWhiteSpace(node.Identifier.Name))
                    {
                        return;
                    }
                    var variable = scope.CreateVariable(VariableKind.Iteration, node.Identifier.Name, node);
                    _variables.Add(node.Identifier.IdentifierName, variable);
                    _variables.Add(node.Identifier, variable);
                    Visit(node.Body);
                }
                finally
                {
                    PopScope(scope);
                }
            }
Beispiel #2
0
            public override void VisitNumericForStatement(NumericForStatementSyntax node)
            {
                Visit(node.InitialValue);
                Visit(node.FinalValue);
                if (node.StepValue is not null)
                {
                    Visit(node.StepValue);
                }

                var scope = CreateBlockScope(node);

                try
                {
                    var variable = scope.CreateVariable(VariableKind.Iteration, node.Identifier.Name, node);
                    _variables[node.Identifier] = variable;
                    Visit(node.Body);
                }
                finally
                {
                    PopScope(scope);
                }
            }