Beispiel #1
0
        protected bool ProcessSyntaxNodeAttribute(SyntaxTree syntaxTree, ALSymbolInformation parent, SyntaxNode node)
        {
            switch (node.Kind.ConvertToLocalType())
            {
            case ConvertedSyntaxKind.PropertyList:
                bool hasProperties = this.ProcessSyntaxNodePropertyList(syntaxTree, parent, node);
                return(!this.IncludeProperties);      // || (!hasProperties);

            case ConvertedSyntaxKind.SimpleTypeReference:
            case ConvertedSyntaxKind.RecordTypeReference:
            case ConvertedSyntaxKind.DotNetTypeReference:
                parent.subtype        = node.ToFullString();
                parent.elementsubtype = node.GetType().TryGetPropertyValueAsString(node, "DataType");
                if (String.IsNullOrWhiteSpace(parent.elementsubtype))
                {
                    parent.elementsubtype = parent.subtype;
                }
                return(true);

            case ConvertedSyntaxKind.MemberAttribute:
                string memberAttributeName = node.GetSyntaxNodeName().NotNull();
                if ((parent.kind == ALSymbolKind.MethodDeclaration) || (parent.kind == ALSymbolKind.LocalMethodDeclaration))
                {
                    ALSymbolKind newKind = ALSyntaxHelper.MemberAttributeToMethodKind(memberAttributeName);
                    if (newKind != ALSymbolKind.Undefined)
                    {
                        parent.kind = newKind;
                        return(true);
                    }
                }
                parent.subtype = memberAttributeName;
                return(true);

            case ConvertedSyntaxKind.ObjectId:
                ObjectIdSyntax objectIdSyntax = (ObjectIdSyntax)node;
                if ((objectIdSyntax.Value != null) && (objectIdSyntax.Value.Value != null))
                {
                    parent.id = (int)objectIdSyntax.Value.Value;
                }
                return(true);

            case ConvertedSyntaxKind.IdentifierName:
                var lineSpan = syntaxTree.GetLineSpan(node.Span);
                parent.selectionRange = new Range(lineSpan.StartLinePosition.Line, lineSpan.StartLinePosition.Character,
                                                  lineSpan.EndLinePosition.Line, lineSpan.EndLinePosition.Character);
                return(true);

            case ConvertedSyntaxKind.VariableListDeclaration:
                //safe call as variable list declaration nodes are not supported by Nav2018
                this.SafeProcessVariableListDeclarationNode(syntaxTree, parent, node);
                return(true);
            }
            return(false);
        }
Beispiel #2
0
        protected bool ProcessSyntaxNodeAttribute(dynamic syntaxTree, ALSymbolInformation parent, dynamic node)
        {
            ConvertedSyntaxKind kind = ALEnumConverters.SyntaxKindConverter.Convert(node.Kind);

            switch (kind)
            {
            case ConvertedSyntaxKind.PropertyList:
                this.ProcessSyntaxNodePropertyList(syntaxTree, parent, node);
                return(true);

            case ConvertedSyntaxKind.SimpleTypeReference:
            case ConvertedSyntaxKind.RecordTypeReference:
            case ConvertedSyntaxKind.DotNetTypeReference:
                parent.subtype = node.ToFullString();
                return(true);

            case ConvertedSyntaxKind.MemberAttribute:
                string memberAttributeName = node.Name.ToString();
                if ((parent.kind == ALSymbolKind.MethodDeclaration) || (parent.kind == ALSymbolKind.LocalMethodDeclaration))
                {
                    ALSymbolKind newKind = ALSyntaxHelper.MemberAttributeToMethodKind(memberAttributeName);
                    if (newKind != ALSymbolKind.Undefined)
                    {
                        parent.kind = newKind;
                        return(true);
                    }
                }
                parent.subtype = memberAttributeName;
                return(true);

            case ConvertedSyntaxKind.ObjectId:
                if ((node.Value != null) && (node.Value.Value != null))
                {
                    parent.id = node.Value.Value;
                }
                return(true);

            case ConvertedSyntaxKind.IdentifierName:
                dynamic lineSpan = syntaxTree.GetLineSpan(node.Span);
                parent.selectionRange = new Range(lineSpan.StartLinePosition.Line, lineSpan.StartLinePosition.Character,
                                                  lineSpan.EndLinePosition.Line, lineSpan.EndLinePosition.Character);
                return(true);
            }
            return(false);
        }
 protected override ALSymbolKind GetALSymbolKind()
 {
     if (this.Attributes != null)
     {
         for (int i = 0; i < this.Attributes.Count; i++)
         {
             ALSymbolKind kind = ALSyntaxHelper.MemberAttributeToMethodKind(this.Attributes[i].Name);
             if (kind != ALSymbolKind.Undefined)
             {
                 return(kind);
             }
         }
     }
     if (this.IsLocal)
     {
         return(ALSymbolKind.LocalMethodDeclaration);
     }
     return(ALSymbolKind.MethodDeclaration);
 }
            private ALSymbolKind GetKind(SyntaxNode node)
            {
                ConvertedSyntaxKind kind = node.Kind.ConvertToLocalType();

                switch (kind)
                {
                case ConvertedSyntaxKind.TriggerDeclaration:
                    return(ALSymbolKind.TriggerDeclaration);

                case ConvertedSyntaxKind.MethodDeclaration:
                    MethodDeclarationSyntax methodNode = node as MethodDeclarationSyntax;
                    foreach (MemberAttributeSyntax att in methodNode.Attributes)
                    {
                        ALSymbolKind alKind = ALSyntaxHelper.MemberAttributeToMethodKind(att.GetNameStringValue());
                        if (alKind != ALSymbolKind.Undefined)
                        {
                            return(alKind);
                        }
                    }
                    return(ALSymbolKind.MethodDeclaration);
                }
                return(ALSymbolKind.Undefined);
            }