private static QualifiedNameSyntax GetQualifiedNameSyntax(IReadOnlyCollection <string> names)
        {
            var ids = names.Select(SyntaxFactory.IdentifierName).ToArray();

            var index = 0;
            QualifiedNameSyntax left = null;

            while (index + 1 < names.Count)
            {
                left = left == null?SyntaxFactory.QualifiedName(ids[index], ids[index + 1]) : SyntaxFactory.QualifiedName(left, ids[index + 1]);

                index++;
            }
            return(left);
        }
        private static SimpleNameSyntax GetLeftMostSimpleName(QualifiedNameSyntax qn)
        {
            while (qn != null)
            {
                var left = qn.Left;
                if (left is SimpleNameSyntax simpleName)
                {
                    return(simpleName);
                }

                qn = left as QualifiedNameSyntax;
            }

            return(null);
        }
        public override SyntaxNode VisitQualifiedName(QualifiedNameSyntax node)
        {
            var name = node.WithoutTrivia().ToFullString();

            if (TryGetValue(name, out var typeName))
            {
                return(SyntaxFactory.ParseName(typeName)
                       .WithLeadingTrivia(node.GetLeadingTrivia())
                       .WithTrailingTrivia(node.GetTrailingTrivia()));
            }
            else
            {
                return(base.VisitQualifiedName(node));
            }
        }
Exemple #4
0
        public override void VisitQualifiedName(QualifiedNameSyntax node)
        {
            SymbolInfo symInfo = m_Model.GetSymbolInfo(node);
            var        sym     = symInfo.Symbol;

            if (null != sym)
            {
                string fullName = ClassInfo.GetFullName(sym);
                CodeBuilder.Append(fullName);
            }
            else
            {
                ReportIllegalSymbol(node, symInfo);
                CodeBuilder.Append(node.GetText());
            }
        }
        public override void VisitQualifiedName(QualifiedNameSyntax node)
        {
            if (_ignoredSpans?.HasIntervalThatOverlapsWith(node.FullSpan.Start, node.FullSpan.Length) ?? false)
            {
                return;
            }

            if (node.IsKind(SyntaxKind.QualifiedName) && TrySimplify(node))
            {
                // found a match. report it and stop processing.
                return;
            }

            // descend further.
            DefaultVisit(node);
        }
Exemple #6
0
            static void rec(QualifiedElement q, QualifiedNameSyntax name)
            {
                if (name.Left is QualifiedNameSyntax qs)
                {
                    rec(q, qs);
                }
                else if (name.Left is SimpleNameSyntax sn)
                {
                    _ = new IdentityElement(q, sn.Identifier.Text);
                }
                else
                {
                    throw new InvalidOperationException($"{name.Left.GetType().Name} is unexpected");
                }

                _ = new IdentityElement(q, name.Right.Identifier.Text);
            }
Exemple #7
0
            public override void VisitQualifiedName(QualifiedNameSyntax node)
            {
                bool seenConstructedBeforeRight = _seenConstructed;

                // Visit Right first because it's smaller (to make backtracking cheaper).
                Visit(node.Right);

                bool seenConstructedBeforeLeft = _seenConstructed;

                Visit(node.Left);

                // If the first time we saw a constructed type was in Left, then we need to re-visit Right
                if (!seenConstructedBeforeRight && !seenConstructedBeforeLeft && _seenConstructed)
                {
                    Visit(node.Right);
                }
            }
Exemple #8
0
        public virtual ULTypeInfo GetTypeInfo(TypeSyntax typeSyntax)
        {
            if (typeSyntax == null)
            {
                return(null);
            }

            if (typeSyntax is PredefinedTypeSyntax)
            {
                PredefinedTypeSyntax predefinedTypeSyntax = typeSyntax as PredefinedTypeSyntax;
                string typeName = GetKeywordTypeName(predefinedTypeSyntax.Keyword.Text);
                return(Data.GetType("System." + typeName));
            }
            else if (typeSyntax is IdentifierNameSyntax)
            {
                IdentifierNameSyntax ts = typeSyntax as IdentifierNameSyntax;
                var identifier          = ts.Identifier.Text;
                var info = GetIdentifierInfo(identifier);
                if (info != null)
                {
                    return(Data.GetType(info.TypeID));
                }
            }
            else if (typeSyntax is QualifiedNameSyntax)
            {
                QualifiedNameSyntax qns = typeSyntax as QualifiedNameSyntax;
                string name_space       = qns.Left.ToString();
                var    name             = qns.Right.Identifier.Text;
                //Metadata.Expression.QualifiedNameSyntax my_qns = new Metadata.Expression.QualifiedNameSyntax();
                //my_qns.Left = GetTypeSyntax(qns.Left) as Metadata.Expression.NameSyntax;

                return(Data.GetType(name_space + "." + name));
            }
            else
            {
                Console.Error.WriteLine("不支持的类型语法 " + typeSyntax.GetType().FullName);
            }

            if (Parent != null)
            {
                return(Parent.GetTypeInfo(typeSyntax));
            }

            return(null);
        }
            public override SyntaxNode VisitQualifiedName(QualifiedNameSyntax node)
            {
                var oldAlwaysSimplify = this.alwaysSimplify;

                if (!this.alwaysSimplify)
                {
                    this.alwaysSimplify = node.HasAnnotation(Simplifier.Annotation);
                }

                var result = SimplifyExpression(
                    node,
                    newNode: base.VisitQualifiedName(node),
                    simplifier: s_simplifyName);

                this.alwaysSimplify = oldAlwaysSimplify;

                return(result);
            }
        // "System.IO"
        public override void VisitQualifiedName(QualifiedNameSyntax node)
        {
            ITypeSymbol typeSymbol = _model.GetTypeInfo(node).Type;

            if (typeSymbol == null)
            {
                return;
            }
            string fullName = typeSymbol.ToString();

            foreach (string ns in _namespaceToCheck)
            {
                if (Regex.IsMatch(fullName, ns))
                {
                    return;
                }
            }
        }
        public override SyntaxNode VisitQualifiedName(QualifiedNameSyntax node)
        {
            var visited = base.VisitQualifiedName(node);

            if (visited is null)
            {
                return(visited);
            }

            var matched = TryMatchInput(node, out var matchingInput);

            if (matched)
            {
                AddDependency(matchingInput, DependencyKind.Reference);
            }

            return(node); //SyntaxFactory.QualifiedName(node.Left, SyntaxFactory.IdentifierName(node.Right + "QUALIFIED")).WithTriviaFrom(node);
        }
        public static string ToTypescript(this QualifiedNameSyntax syntaxItem)
        {
            // check for Generic List
            // TODO: Other known types?
            if (syntaxItem.ToFullType().StartsWith("System.Collections.Generic.List<"))
            {
                return(syntaxItem.Right.ToTypescript());
            }

            var fullType = Pocoyo.MapKnownType(syntaxItem.ToFullType());

            if (!string.IsNullOrEmpty(fullType))
            {
                return(fullType);
            }

            // Can't get full type so return any
            return("any");
        }
Exemple #13
0
        /// <inheritdoc/>
        public override SyntaxNode?VisitQualifiedName(QualifiedNameSyntax node)
        {
            TypeInfo info = SemanticModel.GetTypeInfo(node);

            if (info.Type is not INamedTypeSymbol symbol)
            {
                return(base.VisitQualifiedName(node));
            }

            string[] namespaces = symbol.GetContainingNamespacesAndTypes().Select(n => n.Name).ToArray();

            if (namespaces.Length < 2)
            {
                return(base.VisitQualifiedName(node));
            }
            else
            {
                return(QualifiedName(AnalysisUtilities.JoinIntoQualifiedName(namespaces) !, node.Right.WithoutTrivia()).WithTriviaFrom(node));
            }
        }
Exemple #14
0
        private static string GetMetadataNameOfQualifiedNameSyntax(QualifiedNameSyntax originalSyntax)
        {
            SyntaxNode     syntax = originalSyntax;
            Stack <string> parts  = new();

            while (true)
            {
                if (syntax is QualifiedNameSyntax qualifiedNameSyntax)
                {
                    syntax = qualifiedNameSyntax.Left;
                    parts.Push(GetGenericNameWithArity(qualifiedNameSyntax.Right));
                }
                else
                {
                    parts.Push(GetGenericNameWithArity(syntax));
                    break;
                }
            }

            return(parts.Join("."));
        }
        private static Task <Document> ExecuteAsync(CodeFixExecutionContext <TypeDeclarationSyntax> context, INamedTypeSymbol attribute)
        {
            INamespaceSymbol? @namespace = (context.SemanticModel.GetSymbolInfo(context.Node).Symbol?.ContainingNamespace) ?? context.Compilation.GlobalNamespace;

            NameSyntax attrName;
            NameSyntax enumName;

            if (context.SemanticModel.HasUsingDirective(context.Root.Usings, @namespace, attribute, context.CancellationToken))
            {
                attrName = SyntaxFactory.IdentifierName("DefaultParamConfiguration");
                enumName = SyntaxFactory.IdentifierName(nameof(TypeConvention));
            }
            else
            {
                QualifiedNameSyntax n =
                    SyntaxFactory.QualifiedName(
                        SyntaxFactory.IdentifierName("Durian"),
                        SyntaxFactory.IdentifierName("Configuration"));

                attrName = SyntaxFactory.QualifiedName(n, SyntaxFactory.IdentifierName("DefaultParamConfiguration"));
                enumName = SyntaxFactory.QualifiedName(n, SyntaxFactory.IdentifierName(nameof(TypeConvention)));
            }

            TypeDeclarationSyntax type = context.Node.AddAttributeLists(SyntaxFactory.AttributeList(SyntaxFactory.SingletonSeparatedList(
                                                                                                        SyntaxFactory.Attribute(attrName,
                                                                                                                                SyntaxFactory.AttributeArgumentList(SyntaxFactory.SingletonSeparatedList(
                                                                                                                                                                        SyntaxFactory.AttributeArgument(
                                                                                                                                                                            SyntaxFactory.MemberAccessExpression(
                                                                                                                                                                                SyntaxKind.SimpleMemberAccessExpression,
                                                                                                                                                                                enumName,
                                                                                                                                                                                SyntaxFactory.IdentifierName(nameof(TypeConvention.Copy))))
                                                                                                                                                                        .WithNameEquals(
                                                                                                                                                                            SyntaxFactory.NameEquals(
                                                                                                                                                                                SyntaxFactory.IdentifierName(MemberNames.Config_TypeConvention),
                                                                                                                                                                                SyntaxFactory.Token(SyntaxKind.EqualsToken).WithTrailingTrivia(SyntaxFactory.Space)))))))));

            context.RegisterChange(context.Node, type);
            return(Task.FromResult(context.Document));
        }
        public override SyntaxNode VisitQualifiedName(QualifiedNameSyntax node)
        {
            var type = sem.GetTypeInfo(node).Type
                       ?? sem.GetTypeInfo(node.Parent).Type;

            //todo: find out what is breaking when using alias solution
            if (type is INamedTypeSymbol namedType && !node.Parent.IsKind(SyntaxKind.UsingDirective))
            {
                if (true || namedType.IsGenericType)
                {
                    requiredUsings.Add(type.ContainingNamespace.ToString());
                    return(Visit(node.Right)
                           .WithTriviaFrom(node));
                }

                var typeAlias = node.ToString().Replace(".", "_");
                typeAliases[typeAlias] = type.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat.WithGlobalNamespaceStyle(SymbolDisplayGlobalNamespaceStyle.Omitted));
                return(IdentifierName(typeAlias)
                       .WithTriviaFrom(node));
            }

            return(node);
        }
Exemple #17
0
        private ImmutableArray <ISymbol> GetSymbolsOffOfContainer()
        {
            // Ensure that we have the correct token in A.B| case
            var node = _context.TargetToken.GetRequiredParent();

            return(node switch
            {
                MemberAccessExpressionSyntax {
                    RawKind : (int)SyntaxKind.SimpleMemberAccessExpression
                } memberAccess
                => GetSymbolsOffOfExpression(memberAccess.Expression),
                MemberAccessExpressionSyntax {
                    RawKind : (int)SyntaxKind.PointerMemberAccessExpression
                } memberAccess
                => GetSymbolsOffOfDereferencedExpression(memberAccess.Expression),

                // This code should be executing only if the cursor is between two dots in a dotdot token.
                RangeExpressionSyntax rangeExpression => GetSymbolsOffOfExpression(rangeExpression.LeftOperand),
                QualifiedNameSyntax qualifiedName => GetSymbolsOffOfName(qualifiedName.Left),
                AliasQualifiedNameSyntax aliasName => GetSymbolsOffOffAlias(aliasName.Alias),
                MemberBindingExpressionSyntax _ => GetSymbolsOffOfConditionalReceiver(node.GetParentConditionalAccessExpression() !.Expression),
                _ => ImmutableArray <ISymbol> .Empty,
            });
Exemple #18
0
        private BoundType BindQualifiedType(QualifiedNameSyntax qualifiedName)
        {
            var container = LookupContainer(qualifiedName.Left);

            if (container == null)
                return new BoundUnknownType();

            var symbols = container.Members.OfType<TypeSymbol>()
                .Where(x => x.Name == qualifiedName.Right.Name.Text)
                .ToImmutableArray();

            if (symbols.Length == 0)
            {
                Diagnostics.ReportUndeclaredType(qualifiedName);
                return new BoundUnknownType();
            }

            if (symbols.Length > 1)
                Diagnostics.ReportAmbiguousType(qualifiedName.Right.Name, symbols);

            Bind(qualifiedName.Right, x => new BoundName(symbols.First()));

            return new BoundName(symbols.First());
        }
        public QualifiedNameTranslation(QualifiedNameSyntax syntax, SyntaxTranslation parent) : base(syntax, parent)
        {
            Left  = syntax.Left.Get <NameTranslation>(this);
            Right = syntax.Right.Get <SimpleNameTranslation>(this);

            var genericTranslation = Left as GenericNameTranslation;

            if (genericTranslation != null)
            {
                ((GenericNameTranslation)Left).ExcludeTypeParameter = true;
            }

            var simpleName = Right as SimpleNameTranslation;

            if (simpleName != null)
            {
                simpleName.DetectApplyThis = false;
                var identifierName = simpleName as IdentifierNameTranslation;
                if (genericTranslation != null && identifierName != null)
                {
                    identifierName.TypeArgumentList = genericTranslation.TypeArgumentList;
                }
            }
        }
        public override SyntaxNode VisitQualifiedName(QualifiedNameSyntax node)
        {
            var fullName = node.ToString();

            if (SymbolTable.Instance.Namespaces.Contains(fullName))
            {
                return(node);
            }
            var leftFullName = node.Left.ToString();

            if (SymbolTable.Instance.Namespaces.Contains(leftFullName))
            {
                return(node.Right);
            }
            foreach (var ns in SymbolTable.Instance.Namespaces)
            {
                if (leftFullName.IndexOf(ns) == 0)
                {
                    var leftName = leftFullName.Substring(ns.Length + 1);
                    return(SyntaxFactory.QualifiedName(SyntaxFactory.GenericName(leftName), node.Right));
                }
            }
            return(base.VisitQualifiedName(node));
        }
Exemple #21
0
        private static void HandleThrow(SyntaxNodeAnalysisContext context)
        {
            ObjectCreationExpressionSyntax creation = null;

            switch (context.Node)
            {
            case ThrowStatementSyntax statement:
                creation = statement.Expression as ObjectCreationExpressionSyntax;
                break;

            case ThrowExpressionSyntax expression:
                creation = expression.Expression as ObjectCreationExpressionSyntax;
                break;
            }

            if (creation != null)
            {
                switch (creation.Type.Kind())
                {
                case SyntaxKind.IdentifierName:
                    IdentifierNameSyntax identifier = (IdentifierNameSyntax)creation.Type;
                    HandleExceptionType(context, identifier);
                    break;

                case SyntaxKind.QualifiedName:
                    QualifiedNameSyntax qualifiedName = (QualifiedNameSyntax)creation.Type;
                    if (qualifiedName.Right.IsKind(SyntaxKind.IdentifierName) &&
                        string.Concat(qualifiedName.Left.DescendantTokens()) == "System")
                    {
                        HandleExceptionType(context, (IdentifierNameSyntax)qualifiedName.Right);
                    }

                    break;
                }
            }
        }
Exemple #22
0
 public virtual void VisitQualifiedName(QualifiedNameSyntax node) =>
 this.DefaultVisit(node);
        private static async Task <Document> SubclassViewModelBaseFullyQualifiedAsync(CodeFixContext context, ClassDeclarationSyntax classDeclaration, QualifiedNameSyntax viewModelBaseType, CancellationToken cancellationToken)
        {
            var editor = await DocumentEditor.CreateAsync(context.Document, cancellationToken)
                         .ConfigureAwait(false);

            AddBaseType(context, classDeclaration, viewModelBaseType, editor);
            return(editor.GetChangedDocument());
        }
 private string QualifiedName(QualifiedNameSyntax qns)
 {
     string qName = "";
     ChildSyntaxList idn = qns.ChildNodesAndTokens();
     foreach(SyntaxNodeOrToken snot in idn)
     {
         if (snot.IsToken)
         {
             SyntaxToken st = (SyntaxToken)snot;
             if (st.IsKind(SyntaxKind.IdentifierToken))
             {
                 qName += st.ValueText;
             }
             else if (st.IsKind(SyntaxKind.DotToken))
             {
                 qName += ".";
             }
         }
     }
     return qName;
 }
 public static async Task ComputeRefactoringsAsync(RefactoringContext context, QualifiedNameSyntax qualifiedName)
 {
     if (context.IsRefactoringEnabled(RefactoringIdentifiers.AddUsingDirective) &&
         context.Span.IsEmpty &&
         context.SupportsSemanticModel &&
         qualifiedName.DotToken.Span.Start == context.Span.Start &&
         qualifiedName.Left?.IsKind(SyntaxKind.IdentifierName) == true)
     {
         await AddUsingDirectiveRefactoring.ComputeRefactoringsAsync(context, (IdentifierNameSyntax)qualifiedName.Left).ConfigureAwait(false);
     }
 }
        public void VisitQualifiedName(QualifiedNameSyntax node)
        {
            if (node == null)
                throw new ArgumentNullException("node");

            node.Validate();

            ExpressionStart(node);

            node.Left.Accept(this);
            _writer.WriteSyntax(Syntax.Dot);
            node.Right.Accept(this);

            ExpressionEnd(node);
        }
 public override SyntaxNode VisitQualifiedName(QualifiedNameSyntax node) => ProcessTypeSyntax(node);
Exemple #28
0
 public override void VisitQualifiedName(QualifiedNameSyntax node)
 {
     Writer.WriteJsRawValue($"{node.Left}.{node.Right}");
 }
Exemple #29
0
 private static NameSyntax GetReplacementQualifiedName(QualifiedNameSyntax symbolNameSyntax, QualifiedNameSyntax nameSyntax)
 {
     if (nameSyntax.Right.IsKind(SyntaxKind.GenericName))
     {
         return(GetReplacementGenericName(symbolNameSyntax, (GenericNameSyntax)nameSyntax.Right));
     }
     else
     {
         return(symbolNameSyntax);
     }
 }
Exemple #30
0
    // public string getEdgeLabels(SyntaxToken parent, SyntaxToken node)
    public string getEdgeLabels(SyntaxNode parent, SyntaxNode node)
    {
        string edgeLabelName = "" + node.Kind();

        switch (parent.Kind())
        {
        // names & type-names
        case SyntaxKind.IdentifierName:        // = 8616,
            break;

        case SyntaxKind.QualifiedName:        // = 8617,
            // Console.WriteLine("Sorry, not implemented! node.Kind = " + node.Kind());

            QualifiedNameSyntax qualifiedNameNode = parent as QualifiedNameSyntax;

            // Console.WriteLine("   --- qualifiedNameNode.Kind      = " + qualifiedNameNode.Kind());
            // Console.WriteLine("   --- qualifiedNameNode.Qualifier = " + qualifiedNameNode.Qualifier());
            // Console.WriteLine("   --- qualifiedNameNode.Name      = " + qualifiedNameNode.Name());
            // Console.WriteLine("   --- qualifiedNameNode.Qualifier = " + qualifiedNameNode.Identifier);
            // Console.WriteLine("   --- qualifiedNameNode.Name      = " + qualifiedNameNode.Name());
            // Console.WriteLine("   --- qualifiedNameNode.Name      = " + qualifiedNameNode.GetUnqualifiedName);
            // Console.WriteLine("   --- qualifiedNameNode.Left  = " + qualifiedNameNode.Left);
            // Console.WriteLine("   --- qualifiedNameNode.Right = " + qualifiedNameNode.Right);

            if (qualifiedNameNode.Left == node)
            {
                edgeLabelName = "left";
            }
            else
            {
                edgeLabelName = "right";
            }

            break;

        case SyntaxKind.GenericName:         // = 8618,
        case SyntaxKind.TypeArgumentList:    // = 8619,
        case SyntaxKind.AliasQualifiedName:  // = 8620,
        case SyntaxKind.PredefinedType:      // = 8621,
        case SyntaxKind.ArrayType:           // = 8622,
        case SyntaxKind.ArrayRankSpecifier:  // = 8623,
        case SyntaxKind.PointerType:         // = 8624,
        case SyntaxKind.NullableType:        // = 8625,
        case SyntaxKind.OmittedTypeArgument: // = 8626,
            break;

        // expressions
        case SyntaxKind.ParenthesizedExpression:             // = 8632,
        case SyntaxKind.ConditionalExpression:               // = 8633,
        case SyntaxKind.InvocationExpression:                // = 8634,
        case SyntaxKind.ElementAccessExpression:             // = 8635,
        case SyntaxKind.ArgumentList:                        // = 8636,
        case SyntaxKind.BracketedArgumentList:               // = 8637,
        case SyntaxKind.Argument:                            // = 8638,
        case SyntaxKind.NameColon:                           // = 8639,
        case SyntaxKind.CastExpression:                      // = 8640,
        case SyntaxKind.AnonymousMethodExpression:           // = 8641,
        case SyntaxKind.SimpleLambdaExpression:              // = 8642,
        case SyntaxKind.ParenthesizedLambdaExpression:       // = 8643,
        case SyntaxKind.ObjectInitializerExpression:         // = 8644,
        case SyntaxKind.CollectionInitializerExpression:     // = 8645,
        case SyntaxKind.ArrayInitializerExpression:          // = 8646,
        case SyntaxKind.AnonymousObjectMemberDeclarator:     // = 8647,
        case SyntaxKind.ComplexElementInitializerExpression: // = 8648,
        case SyntaxKind.ObjectCreationExpression:            // = 8649,
        case SyntaxKind.AnonymousObjectCreationExpression:   // = 8650,
        case SyntaxKind.ArrayCreationExpression:             // = 8651,
        case SyntaxKind.ImplicitArrayCreationExpression:     // = 8652,
        case SyntaxKind.StackAllocArrayCreationExpression:   // = 8653,
        case SyntaxKind.OmittedArraySizeExpression:          // = 8654,
        case SyntaxKind.InterpolatedStringExpression:        // = 8655,
        case SyntaxKind.ImplicitElementAccess:               // = 8656,
        case SyntaxKind.IsPatternExpression:                 // = 8657,
            break;

        // binary expressions
        case SyntaxKind.AddExpression:                 // = 8668,
        case SyntaxKind.SubtractExpression:            // = 8669,
        case SyntaxKind.MultiplyExpression:            // = 8670,
        case SyntaxKind.DivideExpression:              // = 8671,
        case SyntaxKind.ModuloExpression:              // = 8672,
        case SyntaxKind.LeftShiftExpression:           // = 8673,
        case SyntaxKind.RightShiftExpression:          // = 8674,
        case SyntaxKind.LogicalOrExpression:           // = 8675,
        case SyntaxKind.LogicalAndExpression:          // = 8676,
        case SyntaxKind.BitwiseOrExpression:           // = 8677,
        case SyntaxKind.BitwiseAndExpression:          // = 8678,
        case SyntaxKind.ExclusiveOrExpression:         // = 8679,
        case SyntaxKind.EqualsExpression:              // = 8680,
        case SyntaxKind.NotEqualsExpression:           // = 8681,
        case SyntaxKind.LessThanExpression:            // = 8682,
        case SyntaxKind.LessThanOrEqualExpression:     // = 8683,
        case SyntaxKind.GreaterThanExpression:         // = 8684,
        case SyntaxKind.GreaterThanOrEqualExpression:  // = 8685,
        case SyntaxKind.IsExpression:                  // = 8686,
        case SyntaxKind.AsExpression:                  // = 8687,
        case SyntaxKind.CoalesceExpression:            // = 8688,
        case SyntaxKind.SimpleMemberAccessExpression:  // = 8689,  // dot access:   a.b
        case SyntaxKind.PointerMemberAccessExpression: // = 8690,  // arrow access:   a->b
        case SyntaxKind.ConditionalAccessExpression:   // = 8691,    // question mark access:   a?.b , a?[1]
            break;

        // binding expressions
        case SyntaxKind.MemberBindingExpression:        // = 8707,
        case SyntaxKind.ElementBindingExpression:       // = 8708,
            break;

        // binary assignment expressions
        case SyntaxKind.SimpleAssignmentExpression:      // = 8714,
        case SyntaxKind.AddAssignmentExpression:         // = 8715,
        case SyntaxKind.SubtractAssignmentExpression:    // = 8716,
        case SyntaxKind.MultiplyAssignmentExpression:    // = 8717,
        case SyntaxKind.DivideAssignmentExpression:      // = 8718,
        case SyntaxKind.ModuloAssignmentExpression:      // = 8719,
        case SyntaxKind.AndAssignmentExpression:         // = 8720,
        case SyntaxKind.ExclusiveOrAssignmentExpression: // = 8721,
        case SyntaxKind.OrAssignmentExpression:          // = 8722,
        case SyntaxKind.LeftShiftAssignmentExpression:   // = 8723,
        case SyntaxKind.RightShiftAssignmentExpression:  // = 8724,
            break;

        // unary expressions
        case SyntaxKind.UnaryPlusExpression:          // = 8730,
        case SyntaxKind.UnaryMinusExpression:         // = 8731,
        case SyntaxKind.BitwiseNotExpression:         // = 8732,
        case SyntaxKind.LogicalNotExpression:         // = 8733,
        case SyntaxKind.PreIncrementExpression:       // = 8734,
        case SyntaxKind.PreDecrementExpression:       // = 8735,
        case SyntaxKind.PointerIndirectionExpression: // = 8736,
        case SyntaxKind.AddressOfExpression:          // = 8737,
        case SyntaxKind.PostIncrementExpression:      // = 8738,
        case SyntaxKind.PostDecrementExpression:      // = 8739,
        case SyntaxKind.AwaitExpression:              // = 8740,
            break;

        // primary expression
        case SyntaxKind.ThisExpression:             // = 8746,
        case SyntaxKind.BaseExpression:             // = 8747,
        case SyntaxKind.ArgListExpression:          // = 8748,
        case SyntaxKind.NumericLiteralExpression:   // = 8749,
        case SyntaxKind.StringLiteralExpression:    // = 8750,
        case SyntaxKind.CharacterLiteralExpression: // = 8751,
        case SyntaxKind.TrueLiteralExpression:      // = 8752,
        case SyntaxKind.FalseLiteralExpression:     // = 8753,
        case SyntaxKind.NullLiteralExpression:      // = 8754,
        case SyntaxKind.DefaultLiteralExpression:   // = 8755,
            break;

        // primary function expressions
        case SyntaxKind.TypeOfExpression:        // = 8760,
        case SyntaxKind.SizeOfExpression:        // = 8761,
        case SyntaxKind.CheckedExpression:       // = 8762,
        case SyntaxKind.UncheckedExpression:     // = 8763,
        case SyntaxKind.DefaultExpression:       // = 8764,
        case SyntaxKind.MakeRefExpression:       // = 8765,
        case SyntaxKind.RefValueExpression:      // = 8766,
        case SyntaxKind.RefTypeExpression:       // = 8767,
            break;

        // NameOfExpression: // = 8768, // we represent nameof(x) as an invocation expression

        // query expressions
        case SyntaxKind.QueryExpression:    // = 8774,
        case SyntaxKind.QueryBody:          // = 8775,
        case SyntaxKind.FromClause:         // = 8776,
        case SyntaxKind.LetClause:          // = 8777,
        case SyntaxKind.JoinClause:         // = 8778,
        case SyntaxKind.JoinIntoClause:     // = 8779,
        case SyntaxKind.WhereClause:        // = 8780,
        case SyntaxKind.OrderByClause:      // = 8781,
        case SyntaxKind.AscendingOrdering:  // = 8782,
        case SyntaxKind.DescendingOrdering: // = 8783,
        case SyntaxKind.SelectClause:       // = 8784,
        case SyntaxKind.GroupClause:        // = 8785,
        case SyntaxKind.QueryContinuation:  // = 8786,
            break;

        // statements
        case SyntaxKind.Block:                     // = 8792,
        case SyntaxKind.LocalDeclarationStatement: // = 8793,
        case SyntaxKind.VariableDeclaration:       // = 8794,
        case SyntaxKind.VariableDeclarator:        // = 8795,
        case SyntaxKind.EqualsValueClause:         // = 8796,
        case SyntaxKind.ExpressionStatement:       // = 8797,
        case SyntaxKind.EmptyStatement:            // = 8798,
        case SyntaxKind.LabeledStatement:          // = 8799,
            break;

        // jump statements
        case SyntaxKind.GotoStatement:        // = 8800,
        case SyntaxKind.GotoCaseStatement:    // = 8801,
        case SyntaxKind.GotoDefaultStatement: // = 8802,
        case SyntaxKind.BreakStatement:       // = 8803,
        case SyntaxKind.ContinueStatement:    // = 8804,
        case SyntaxKind.ReturnStatement:      // = 8805,
        case SyntaxKind.YieldReturnStatement: // = 8806,
        case SyntaxKind.YieldBreakStatement:  // = 8807,
        case SyntaxKind.ThrowStatement:       // = 8808,
            break;

        case SyntaxKind.WhileStatement:     // = 8809,
        case SyntaxKind.DoStatement:        // = 8810,
        case SyntaxKind.ForStatement:       // = 8811,
        case SyntaxKind.ForEachStatement:   // = 8812,
            break;

        case SyntaxKind.UsingStatement:        // = 8813,
            // Console.WriteLine("Sorry, not implemented! node.Kind = " + node.Kind());
            break;

        case SyntaxKind.FixedStatement:        // = 8814,
            break;

        // checked statements
        case SyntaxKind.CheckedStatement:        // = 8815,
        case SyntaxKind.UncheckedStatement:      // = 8816,
            break;

        case SyntaxKind.UnsafeStatement:    // = 8817,
        case SyntaxKind.LockStatement:      // = 8818,
        case SyntaxKind.IfStatement:        // = 8819,
        case SyntaxKind.ElseClause:         // = 8820,
        case SyntaxKind.SwitchStatement:    // = 8821,
        case SyntaxKind.SwitchSection:      // = 8822,
        case SyntaxKind.CaseSwitchLabel:    // = 8823,
        case SyntaxKind.DefaultSwitchLabel: // = 8824,
        case SyntaxKind.TryStatement:       // = 8825,
        case SyntaxKind.CatchClause:        // = 8826,
        case SyntaxKind.CatchDeclaration:   // = 8827,
        case SyntaxKind.CatchFilterClause:  // = 8828,
        case SyntaxKind.FinallyClause:      // = 8829,
            break;

        // statements that didn't fit above
        case SyntaxKind.LocalFunctionStatement:        // = 8830,
            break;

        // declarations
        case SyntaxKind.CompilationUnit:        // = 8840,
        case SyntaxKind.GlobalStatement:        // = 8841,
        case SyntaxKind.NamespaceDeclaration:   // = 8842,
            break;

        case SyntaxKind.UsingDirective:        // = 8843,
            // Console.WriteLine("Sorry, not implemented! case SyntaxKind.UsingDirective: node.Kind = " + node.Kind());

            UsingDirectiveSyntax usingDirectiveNode = Parent as UsingDirectiveSyntax;

            // Console.WriteLine("   --- usingDirectiveNode.Kind = " + usingDirectiveNode.Kind());
            // Console.WriteLine("   --- usingDirectiveNode.Name = " + usingDirectiveNode.Name);

            if (usingDirectiveNode.Name == node)
            {
                edgeLabelName = "name";
            }

            break;

        case SyntaxKind.ExternAliasDirective:        // = 8844,
            break;

        // attributes
        case SyntaxKind.AttributeList:            // = 8847,
        case SyntaxKind.AttributeTargetSpecifier: // = 8848,
        case SyntaxKind.Attribute:                // = 8849,
        case SyntaxKind.AttributeArgumentList:    // = 8850,
        case SyntaxKind.AttributeArgument:        // = 8851,
        case SyntaxKind.NameEquals:               // = 8852,
            break;

        // type declarations
        case SyntaxKind.ClassDeclaration:       // = 8855,
        case SyntaxKind.StructDeclaration:      // = 8856,
        case SyntaxKind.InterfaceDeclaration:   // = 8857,
        case SyntaxKind.EnumDeclaration:        // = 8858,
        case SyntaxKind.DelegateDeclaration:    // = 8859,
            break;

        case SyntaxKind.BaseList:                      // = 8864,
        case SyntaxKind.SimpleBaseType:                // = 8865,
        case SyntaxKind.TypeParameterConstraintClause: // = 8866,
        case SyntaxKind.ConstructorConstraint:         // = 8867,
        case SyntaxKind.ClassConstraint:               // = 8868,
        case SyntaxKind.StructConstraint:              // = 8869,
        case SyntaxKind.TypeConstraint:                // = 8870,
        case SyntaxKind.ExplicitInterfaceSpecifier:    // = 8871,
        case SyntaxKind.EnumMemberDeclaration:         // = 8872,
        case SyntaxKind.FieldDeclaration:              // = 8873,
        case SyntaxKind.EventFieldDeclaration:         // = 8874,
            break;

        case SyntaxKind.MethodDeclaration:        // = 8875,
        {
            // Console.WriteLine("case SyntaxKind.MethodDeclaration: node.Kind = " + node.Kind());

            // MethodDeclarationSyntax methodDeclarationNode = Parent as MethodDeclarationSyntax;

            // Console.WriteLine("   Identifier = methodDeclarationNode.Identifier = " + methodDeclarationNode.Identifier);

            break;
        }

        case SyntaxKind.OperatorDeclaration:           // = 8876,
        case SyntaxKind.ConversionOperatorDeclaration: // = 8877,
        case SyntaxKind.ConstructorDeclaration:        // = 8878,
            break;

        case SyntaxKind.BaseConstructorInitializer: // = 8889,
        case SyntaxKind.ThisConstructorInitializer: // = 8890,
        case SyntaxKind.DestructorDeclaration:      // = 8891,
        case SyntaxKind.PropertyDeclaration:        // = 8892,
        case SyntaxKind.EventDeclaration:           // = 8893,
        case SyntaxKind.IndexerDeclaration:         // = 8894,
        case SyntaxKind.AccessorList:               // = 8895,
        case SyntaxKind.GetAccessorDeclaration:     // = 8896,
        case SyntaxKind.SetAccessorDeclaration:     // = 8897,
        case SyntaxKind.AddAccessorDeclaration:     // = 8898,
        case SyntaxKind.RemoveAccessorDeclaration:  // = 8899,
        case SyntaxKind.UnknownAccessorDeclaration: // = 8900,
        case SyntaxKind.ParameterList:              // = 8906,
        case SyntaxKind.BracketedParameterList:     // = 8907,
        case SyntaxKind.Parameter:                  // = 8908,
        case SyntaxKind.TypeParameterList:          // = 8909,
        case SyntaxKind.TypeParameter:              // = 8910,
        case SyntaxKind.IncompleteMember:           // = 8916,
        case SyntaxKind.ArrowExpressionClause:      // = 8917,
            break;

        default:
            Console.WriteLine("Error: default reached in switch over node.Kind = " + node.Kind());
            break;
        }

        return(edgeLabelName);
    }
 public virtual void VisitQualifiedName(QualifiedNameSyntax node)
 {
     DefaultVisit(node);
 }
Exemple #32
0
        public QualifiedNameSyntax ConsumeQualifiedName(NameSyntax left)
        {
            var period = ConsumeToken();
            var id2 = new IdentifierNameSyntax(ConsumeToken());
            var qual = new QualifiedNameSyntax(left, period, id2);
            if (AtDot())
            {
            return ConsumeQualifiedName(qual);
            }

            return qual;
        }
 private ExpressionNode BindMemberAccess(QualifiedNameSyntax node, bool invoked)
 {
     var left = BindExpression(node.Left);
     return BindMemberAccess(node, left, node.Right, invoked);
 }
 /// <inheritdoc />
 public override SyntaxNode VisitQualifiedName(QualifiedNameSyntax node)
 {
     return(base.VisitQualifiedName(node).WithAdditionalAnnotations(Simplifier.Annotation) !);
 }
Exemple #35
0
 public override SyntaxToken VisitQualifiedName(QualifiedNameSyntax node) => VisitIdentifierName((IdentifierNameSyntax)node.Right);
 public override Expr VisitQualifiedName(QualifiedNameSyntax node)
 {
     return(base.VisitQualifiedName(node));
 }
Exemple #37
0
        private NameSyntax ParseName()
        {
            var result = ParseIdentifier() as NameSyntax;

            while (Current.Kind == SyntaxKind.ColonColonToken)
            {
                var colonColon = Match(SyntaxKind.ColonColonToken);
                var right = new IdentifierNameSyntax(Match(SyntaxKind.IdentifierToken));

                result = new QualifiedNameSyntax(result, colonColon, right);
            }

            return result;
        }