コード例 #1
0
        private void WalkArguements()
        {
            HierarchySnapshot hierarchySnapshot = new HierarchySnapshot(this);

            List <PenWebMacroArgument> macroArguments = this.GetAllChildrenByTypeAsList <PenWebMacroArgument>();

            foreach (PenWebMacroArgument penWebMacroArgument in macroArguments)
            {
                if (penWebMacroArgument.IsGood)
                {
                    this.MacroParameters.Add(penWebMacroArgument.ArguementName);
                }
            }

            if (this.MacroCall.ArgumentListNode != null)
            {
                foreach (ITreeNode argumentNode in this.MacroCall.ArgumentListNode.Arguments)
                {
                    string nodeTypeStr = argumentNode.NodeType.ToString();
                    string nodeType    = argumentNode.GetType().Name;
                    string text        = argumentNode.GetText();
                    string firstChild  = argumentNode.FirstChild.GetText();

                    //this.MacroParameters.Add(argumentNode.firstChild.GetText());
                }
            }
            else
            {
                this.MacroParameters.Add("null");
                //LogManager.Self.Log("PenWebMacroCall() ArgumentListNode is null");
            }
        }
コード例 #2
0
        public override void Init()
        {
            try
            {
                CppDeclarationSymbol symbol = this.Declaration.GetSymbol();

                if (symbol != null)
                {
                    this.VariableName = symbol.GetQualifiedName().GetNameStr();
                }
                else
                {
                    LogManager.Self.Log($"PenWebDeclaration() symbol is null");
                }

                AttributeList attributeList = this.Declaration.AttributeListNode;

                if (attributeList != null)
                {
                    foreach (ITreeNode attribute in attributeList.Children())
                    {
                        var typeId   = attribute.NodeType.ToString();
                        var toString = attribute.ToString();
                    }
                }

                base.Init();

                HierarchySnapshot hierarchySnapshot = new HierarchySnapshot(this);

                PenWebDeclarator penWebDeclarator = this.GetChildByType <PenWebDeclarator>();

                if (penWebDeclarator != null)
                {
                    this.VariableName = penWebDeclarator.ItemName;
                }
                else
                {
                    LogManager.Self.Log($"penWebDeclarator is null");
                }

                if (String.IsNullOrWhiteSpace(this.VariableName))
                {
                    PenWebDeclaratorQualifiedName declaratorQualifiedName = this.GetChildByType <PenWebDeclaratorQualifiedName>();

                    if (declaratorQualifiedName != null)
                    {
                        this.VariableName = declaratorQualifiedName.ItemName;
                    }
                    else
                    {
                        LogManager.Self.Log($"declarationSpecifiers is null");
                    }
                }

                PenWebDeclarationSpecifiers declarationSpecifiers = this.GetChildByType <PenWebDeclarationSpecifiers>();

                if (declarationSpecifiers != null)
                {
                    this.TypeName = declarationSpecifiers.ItemName;
                }
                else
                {
                    LogManager.Self.Log($"penWebDeclarator is null");
                }

                PenWebClassSpecifier penWebClassSpecifier = this.GetParentByType <PenWebClassSpecifier>();

                if (penWebClassSpecifier != null)
                {
                    this.OwningClass = penWebClassSpecifier.ClassName;
                }

                this.CppFunctionCatagory = CppFunctionCatagory.VariableDef;

                if (!String.IsNullOrWhiteSpace(this.TypeName) && !String.IsNullOrWhiteSpace(this.VariableName) && !String.IsNullOrWhiteSpace(this.OwningClass))
                {
                    this.SaveToJson = true;
                }
            }
            catch (Exception e)
            {
                LogManager.Self.Log("PenWebDeclaration Exception", e);
            }

            this.Declaration = null;
        }
コード例 #3
0
        public override void Init()
        {
            try
            {
                string prefix = this.SingleLineText.Length > 4 ? this.SingleLineText.Substring(0, 4) : "";

                if (prefix == "DDX_")
                {
                    this.IsDDXExpression = true;
                }

                if (this.CallExpression.InvokedExpression != null)
                {
                    string invokeText = this.CallExpression.InvokedExpression.GetText();

                    invokeText = invokeText.Replace("->", ".");

                    string[] invokeAr = invokeText.Split('.');

                    if (invokeAr.Length == 1)
                    {
                        this.Method = invokeAr[0];
                    }
                    else
                    {
                        List <string> invokeList = new List <string>(invokeAr);

                        int cnt = 1;
                        foreach (string invokeName in invokeList)
                        {
                            if (cnt++ == invokeList.Count)
                            {
                                this.Method = invokeName;
                            }
                            else
                            {
                                this.VariableChain.Add(invokeName);
                            }
                        }
                    }
                }
                else
                {
                    LogManager.Self.Log("PenWebCallExpression() InvokedExpression is null");
                }

                base.Init();

                PenWebMemberAccessExpression penWebMemberAccessExpression = this.GetChildByType <PenWebMemberAccessExpression>();

                if (penWebMemberAccessExpression != null)
                {
                    this.Class = penWebMemberAccessExpression.Class;
                }
                else
                {
                    LogManager.Self.Log("PenWebCallExpression() penWebMemberAccessExpression is null");

                    HierarchySnapshot hierarchySnapshot = new HierarchySnapshot(this);
                }

                List <PenWebMacroReference> macroReferences = this.GetAllChildrenByTypeAsList <PenWebMacroReference>();

                foreach (PenWebMacroReference penWebMacroReference in macroReferences)
                {
                    switch (penWebMacroReference.MacroName)
                    {
                    case "TRUE":
                    case "FALSE":
                        break;

                    default:
                        this.MacroReferences.Add(penWebMacroReference.MacroName);
                        break;
                    }
                }

                PenWebFunctionArgumentList penWebFunctionArgumentList = this.GetChildByType <PenWebFunctionArgumentList>();

                if (penWebFunctionArgumentList != null)
                {
                    List <PenWebQualifiedReference> parameterList = penWebFunctionArgumentList.GetAllChildrenByTypeAsList <PenWebQualifiedReference>();

                    foreach (PenWebQualifiedReference penWebQualifiedReference in parameterList)
                    {
                        string typeName = penWebQualifiedReference.TypeName;
                        string itemName = penWebQualifiedReference.ItemName;

                        if (!String.IsNullOrWhiteSpace(typeName) && !String.IsNullOrWhiteSpace(typeName))
                        {
                            this.ParameterList.Add(penWebQualifiedReference);
                        }
                        else
                        {
                            this.ParameterList.Add(penWebQualifiedReference);
                        }
                    }
                }

                if (this.IsDDXExpression)
                {
                    if (MacroReferences.Count == 0)
                    {
                    }

                    if (ParameterList.Count == 0)
                    {
                    }

                    if (String.IsNullOrWhiteSpace(this.Method))
                    {
                    }

                    this.CppFunctionCatagory = CppFunctionCatagory.DDXCall;
                }
                else
                {
                    this.CppFunctionCatagory = CppFunctionCatagory.MethodCall;
                }


                this.SaveToJson = true;

                foreach (string resourceLabel in this.MacroReferences)
                {
                    ResourceIdContext resourceIdContext = CppResourceManager.Self.GetResourceIdContextByLabel(resourceLabel);

                    if (resourceIdContext != null)
                    {
                        this.ResourceIdContexts.Add(resourceIdContext);
                    }
                }
            }
            catch (Exception e)
            {
                LogManager.Self.Log("PenWebCallExpression Exception", e);
            }

            this.CallExpression    = null;
            this.CppExpressionNode = null;
        }