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)); }
public virtual void VisitParameterExpression(VariableExpressionSyntax node) { DefaultVisit(node); }
public static void ReportUndeclaredVariable(this ICollection <Diagnostic> diagnostics, VariableExpressionSyntax node) { var variableName = node.Name; diagnostics.Report(variableName.Span, DiagnosticId.UndeclaredVariable, variableName.ValueText); }
public virtual TResult VisitParameterExpression(VariableExpressionSyntax node) { return(DefaultVisit(node)); }
private void ClassifyVariableExpression(VariableExpressionSyntax node) { ClassifyExpression(node, node); }