示例#1
0
        public override void VisitDiscardDesignation(DiscardDesignationSyntax node)
        {
            if (!PreVisit(node))
            {
                return;
            }

            base.VisitDiscardDesignation(node);

            PostVisit(node);
        }
示例#2
0
        /// <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);
        }
示例#3
0
 public override Evaluation VisitDiscardDesignation(DiscardDesignationSyntax node)
 {
     return(base.VisitDiscardDesignation(node));
 }
示例#4
0
 private static BoundDiscardExpression BindDiscardExpression(
     DiscardDesignationSyntax designation,
     TypeSymbol declType)
 {
     return new BoundDiscardExpression(designation, declType);
 }
示例#5
0
 public Discard(Context cx, DiscardDesignationSyntax discard, IExpressionParentEntity parent, int child) : this(cx, (CSharpSyntaxNode)discard, parent, child)
 {
 }
示例#6
0
 public override void VisitDiscardDesignation(DiscardDesignationSyntax node)
 {
     base.VisitDiscardDesignation(node);
 }
示例#7
0
 public override void VisitDiscardDesignation(DiscardDesignationSyntax node)
 {
     throw new NotImplementedException();
 }
 private Doc PrintDiscardDesignationSyntax(DiscardDesignationSyntax node)
 {
     return(this.PrintSyntaxToken(node.UnderscoreToken));
 }
示例#9
0
 private static BoundDiscardExpression BindDiscardExpression(
     DiscardDesignationSyntax designation,
     TypeSymbol declType)
 {
     return(new BoundDiscardExpression(designation, declType));
 }
示例#10
0
 public static Doc Print(DiscardDesignationSyntax node)
 {
     return(Token.Print(node.UnderscoreToken));
 }
示例#11
0
 public TameDiscardDesignationSyntax(DiscardDesignationSyntax node)
 {
     Node = node;
     AddChildren();
 }
示例#12
0
 public override void VisitDiscardDesignation(DiscardDesignationSyntax node)
 {
     Log(node, "Unsupported Syntax !");
 }
示例#13
0
        /// <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);
        }
示例#14
0
 /// <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);