public override void VisitDiscardDesignation(DiscardDesignationSyntax node) { if (!PreVisit(node)) { return; } base.VisitDiscardDesignation(node); PostVisit(node); }
/// <summary> /// Try getting the <see cref="ILocalSymbol"/> for the node. /// Gets the semantic model for the tree if the node is not in the tree corresponding to <paramref name="semanticModel"/>. /// </summary> /// <param name="semanticModel">The <see cref="SemanticModel"/>.</param> /// <param name="node">The <see cref="DiscardDesignationSyntax"/>.</param> /// <param name="symbol">The symbol if found.</param> /// <returns>True if a symbol was found.</returns> public static bool TryGetSymbol(this SemanticModel semanticModel, DiscardDesignationSyntax node, [NotNullWhen(true)] out IDiscardSymbol?symbol) { if (semanticModel is null) { throw new ArgumentNullException(nameof(semanticModel)); } if (node is null) { throw new ArgumentNullException(nameof(node)); } symbol = GetDeclaredSymbolSafe(semanticModel, node); return(symbol != null); }
public override Evaluation VisitDiscardDesignation(DiscardDesignationSyntax node) { return(base.VisitDiscardDesignation(node)); }
private static BoundDiscardExpression BindDiscardExpression( DiscardDesignationSyntax designation, TypeSymbol declType) { return new BoundDiscardExpression(designation, declType); }
public Discard(Context cx, DiscardDesignationSyntax discard, IExpressionParentEntity parent, int child) : this(cx, (CSharpSyntaxNode)discard, parent, child) { }
public override void VisitDiscardDesignation(DiscardDesignationSyntax node) { base.VisitDiscardDesignation(node); }
public override void VisitDiscardDesignation(DiscardDesignationSyntax node) { throw new NotImplementedException(); }
private Doc PrintDiscardDesignationSyntax(DiscardDesignationSyntax node) { return(this.PrintSyntaxToken(node.UnderscoreToken)); }
private static BoundDiscardExpression BindDiscardExpression( DiscardDesignationSyntax designation, TypeSymbol declType) { return(new BoundDiscardExpression(designation, declType)); }
public static Doc Print(DiscardDesignationSyntax node) { return(Token.Print(node.UnderscoreToken)); }
public TameDiscardDesignationSyntax(DiscardDesignationSyntax node) { Node = node; AddChildren(); }
public override void VisitDiscardDesignation(DiscardDesignationSyntax node) { Log(node, "Unsupported Syntax !"); }
/// <summary> /// Same as SemanticModel.GetDeclaredSymbol but works when <paramref name="node"/> is not in the syntax tree. /// </summary> /// <param name="semanticModel">The <see cref="SemanticModel"/>.</param> /// <param name="node">The <see cref="VariableDesignationSyntax"/>.</param> /// <param name="cancellationToken">The <see cref="CancellationToken"/>.</param> /// <returns>An <see cref="IDiscardSymbol"/> or null.</returns> public static IDiscardSymbol GetDeclaredSymbolSafe(this SemanticModel semanticModel, DiscardDesignationSyntax node, CancellationToken cancellationToken) { if (node is null) { return(null); } // Working around https://github.com/dotnet/roslyn/issues/34031 // This is not pretty. switch (node.Parent) { case DeclarationExpressionSyntax declarationExpression: return(semanticModel.SemanticModelFor(node) ?.GetSpeculativeSymbolInfo(node.SpanStart, declarationExpression, SpeculativeBindingOption.BindAsExpression).Symbol as IDiscardSymbol); case DeclarationPatternSyntax declarationPattern: return(semanticModel.SemanticModelFor(node) ?.GetSpeculativeSymbolInfo(node.SpanStart, SyntaxFactory.DeclarationExpression(declarationPattern.Type, node), SpeculativeBindingOption.BindAsExpression).Symbol as IDiscardSymbol); } return(null); }
/// <summary> /// Try getting the <see cref="ILocalSymbol"/> for the node. /// Gets the semantic model for the tree if the node is not in the tree corresponding to <paramref name="semanticModel"/>. /// </summary> /// <param name="semanticModel">The <see cref="SemanticModel"/>.</param> /// <param name="node">The <see cref="VariableDesignationSyntax"/>.</param> /// <param name="cancellationToken">The <see cref="CancellationToken"/>.</param> /// <param name="symbol">The symbol if found.</param> /// <returns>True if a symbol was found.</returns> public static bool TryGetSymbol(this SemanticModel semanticModel, DiscardDesignationSyntax node, CancellationToken cancellationToken, out IDiscardSymbol symbol) { symbol = GetDeclaredSymbolSafe(semanticModel, node, cancellationToken); return(symbol != null); }
// // Summary: // Called when the visitor visits a DiscardDesignationSyntax node. public virtual void VisitDiscardDesignation(DiscardDesignationSyntax node);