Пример #1
0
        private BoundExpression BindVariableExpression(VariableExpressionSyntax node)
        {
            var symbols = LookupVariable(node.Name).ToImmutableArray();

            if (symbols.Length == 0)
            {
                Diagnostics.ReportUndeclaredVariable(node);

                return(new BoundErrorExpression());
            }

            if (symbols.Length > 1)
            {
                Diagnostics.ReportAmbiguousVariable(node.Name);
            }

            var variableSymbol = symbols[0];

            return(new BoundVariableExpression(variableSymbol));
        }
Пример #2
0
 public virtual void VisitParameterExpression(VariableExpressionSyntax node)
 {
     DefaultVisit(node);
 }
Пример #3
0
        public static void ReportUndeclaredVariable(this ICollection <Diagnostic> diagnostics, VariableExpressionSyntax node)
        {
            var variableName = node.Name;

            diagnostics.Report(variableName.Span, DiagnosticId.UndeclaredVariable, variableName.ValueText);
        }
Пример #4
0
 public virtual TResult VisitParameterExpression(VariableExpressionSyntax node)
 {
     return(DefaultVisit(node));
 }
 private void ClassifyVariableExpression(VariableExpressionSyntax node)
 {
     ClassifyExpression(node, node);
 }