Changeset View
Changeset View
Standalone View
Standalone View
duchain/builders/declarationbuilder.h
Show First 20 Lines • Show All 50 Lines • ▼ Show 20 Line(s) | |||||
51 | { | 51 | { | ||
52 | public: | 52 | public: | ||
53 | DeclarationBuilder(EditorIntegrator* editor) | 53 | DeclarationBuilder(EditorIntegrator* editor) | ||
54 | : m_currentModifers(0) | 54 | : m_currentModifers(0) | ||
55 | { | 55 | { | ||
56 | m_editor = editor; | 56 | m_editor = editor; | ||
57 | m_findVariable.find = false; | 57 | m_findVariable.find = false; | ||
58 | } | 58 | } | ||
59 | virtual KDevelop::ReferencedTopDUContext build(const KDevelop::IndexedString& url, AstNode* node, | 59 | KDevelop::ReferencedTopDUContext build(const KDevelop::IndexedString& url, AstNode* node, | ||
60 | KDevelop::ReferencedTopDUContext updateContext | 60 | KDevelop::ReferencedTopDUContext updateContext | ||
61 | = KDevelop::ReferencedTopDUContext()); | 61 | = KDevelop::ReferencedTopDUContext()) override; | ||
62 | 62 | | |||
63 | virtual void startVisiting(AstNode* node); | 63 | void startVisiting(AstNode* node) override; | ||
64 | 64 | | |||
65 | protected: | 65 | protected: | ||
66 | virtual void visitClassDeclarationStatement(ClassDeclarationStatementAst *node); | 66 | void visitClassDeclarationStatement(ClassDeclarationStatementAst *node) override; | ||
67 | virtual void visitInterfaceDeclarationStatement(InterfaceDeclarationStatementAst *node); | 67 | void visitInterfaceDeclarationStatement(InterfaceDeclarationStatementAst *node) override; | ||
68 | virtual void visitTraitDeclarationStatement(TraitDeclarationStatementAst *node); | 68 | void visitTraitDeclarationStatement(TraitDeclarationStatementAst *node) override; | ||
69 | virtual void visitClassStatement(ClassStatementAst *node); | 69 | void visitClassStatement(ClassStatementAst *node) override; | ||
70 | virtual void importTraitMethods(ClassStatementAst *node); | 70 | virtual void importTraitMethods(ClassStatementAst *node); | ||
71 | virtual void visitClassExtends(ClassExtendsAst *node); | 71 | void visitClassExtends(ClassExtendsAst *node) override; | ||
72 | virtual void visitClassImplements(ClassImplementsAst *node); | 72 | void visitClassImplements(ClassImplementsAst *node) override; | ||
73 | virtual void visitParameter(ParameterAst *node); | 73 | void visitParameterList(ParameterListAst *node) override; | ||
74 | virtual void visitFunctionDeclarationStatement(FunctionDeclarationStatementAst *node); | 74 | void visitParameter(ParameterAst *node) override; | ||
75 | virtual void visitClassVariable(ClassVariableAst *node); | 75 | void visitFunctionDeclarationStatement(FunctionDeclarationStatementAst *node) override; | ||
76 | virtual void visitConstantDeclaration(ConstantDeclarationAst *node); | 76 | void visitClassVariable(ClassVariableAst *node) override; | ||
77 | virtual void visitTraitAliasStatement(TraitAliasStatementAst *node); | 77 | void visitConstantDeclaration(ConstantDeclarationAst *node) override; | ||
78 | void visitTraitAliasStatement(TraitAliasStatementAst *node) override; | ||||
78 | virtual void createTraitAliasDeclarations(TraitAliasStatementAst *node, KDevelop::DeclarationPointer dec); | 79 | virtual void createTraitAliasDeclarations(TraitAliasStatementAst *node, KDevelop::DeclarationPointer dec); | ||
79 | virtual void visitOuterTopStatement(OuterTopStatementAst* node); | 80 | void visitOuterTopStatement(OuterTopStatementAst* node) override; | ||
80 | virtual void visitAssignmentExpression(AssignmentExpressionAst* node); | 81 | void visitAssignmentExpression(AssignmentExpressionAst* node) override; | ||
81 | virtual void visitAssignmentExpressionEqual(AssignmentExpressionEqualAst *node); | 82 | void visitAssignmentExpressionEqual(AssignmentExpressionEqualAst *node) override; | ||
82 | virtual void visitVariable(VariableAst* node); | 83 | void visitVariable(VariableAst* node) override; | ||
83 | virtual void visitFunctionCall(FunctionCallAst* node); | 84 | void visitFunctionCall(FunctionCallAst* node) override; | ||
84 | virtual void visitFunctionCallParameterList(FunctionCallParameterListAst* node); | 85 | void visitFunctionCallParameterList(FunctionCallParameterListAst* node) override; | ||
85 | virtual void visitFunctionCallParameterListElement(FunctionCallParameterListElementAst* node); | 86 | void visitFunctionCallParameterListElement(FunctionCallParameterListElementAst* node) override; | ||
86 | virtual void visitStatement(StatementAst* node); | 87 | void visitStatement(StatementAst* node) override; | ||
87 | virtual void visitStaticVar(StaticVarAst* node); | 88 | void visitStaticVar(StaticVarAst* node) override; | ||
88 | virtual void visitGlobalVar(GlobalVarAst* node); | 89 | void visitGlobalVar(GlobalVarAst* node) override; | ||
89 | virtual void visitCatchItem(CatchItemAst *node); | 90 | void visitCatchItem(CatchItemAst *node) override; | ||
90 | virtual void visitUnaryExpression( UnaryExpressionAst* node ); | 91 | void visitUnaryExpression( UnaryExpressionAst* node ) override; | ||
91 | virtual void visitAssignmentListElement(AssignmentListElementAst* node); | 92 | void visitAssignmentListElement(AssignmentListElementAst* node) override; | ||
92 | virtual void openNamespace(NamespaceDeclarationStatementAst* parent, IdentifierAst* node, const IdentifierPair& identifier, const KDevelop::RangeInRevision& range); | 93 | void openNamespace(NamespaceDeclarationStatementAst* parent, IdentifierAst* node, const IdentifierPair& identifier, const KDevelop::RangeInRevision& range) override; | ||
93 | virtual void closeNamespace(NamespaceDeclarationStatementAst* parent, IdentifierAst* node, const IdentifierPair& identifier); | 94 | void closeNamespace(NamespaceDeclarationStatementAst* parent, IdentifierAst* node, const IdentifierPair& identifier) override; | ||
94 | virtual void visitUseNamespace(UseNamespaceAst* node); | 95 | void visitUseNamespace(UseNamespaceAst* node) override; | ||
95 | virtual void visitClosure(ClosureAst* node); | 96 | void visitClosure(ClosureAst* node) override; | ||
96 | virtual void visitLexicalVar(LexicalVarAst* node); | 97 | void visitLexicalVar(LexicalVarAst* node) override; | ||
97 | 98 | | |||
98 | /// checks whether the body is empty (i.e. equals ";" instead of "{...}") | 99 | /// checks whether the body is empty (i.e. equals ";" instead of "{...}") | ||
99 | bool isEmptyMethodBody(const MethodBodyAst* body) const { | 100 | bool isEmptyMethodBody(const MethodBodyAst* body) const { | ||
100 | return !body || !body->statements; | 101 | return !body || !body->statements; | ||
101 | } | 102 | } | ||
102 | 103 | | |||
103 | virtual void closeDeclaration(); | 104 | void closeDeclaration() override; | ||
104 | void classContextOpened(KDevelop::DUContext* context); | 105 | void classContextOpened(KDevelop::DUContext* context) override; | ||
105 | 106 | | |||
106 | virtual void supportBuild(AstNode* node, KDevelop::DUContext* context = 0); | 107 | void supportBuild(AstNode* node, KDevelop::DUContext* context = nullptr) override; | ||
107 | virtual void closeContext(); | 108 | void closeContext() override; | ||
108 | 109 | | |||
109 | /// don't forget to closeDeclaration() afterwards | 110 | /// don't forget to closeDeclaration() afterwards | ||
110 | /// set m_currentModifers to your likings and reset it afterwards | 111 | /// set m_currentModifers to your likings and reset it afterwards | ||
111 | void openClassMemberDeclaration(AstNode* node, const KDevelop::QualifiedIdentifier& name); | 112 | void openClassMemberDeclaration(AstNode* node, const KDevelop::QualifiedIdentifier& name); | ||
112 | 113 | | |||
113 | virtual void updateCurrentType(); | 114 | void updateCurrentType() override; | ||
114 | 115 | | |||
115 | private: | 116 | private: | ||
116 | /// because the predeclarationbuilder runs before us, | 117 | /// because the predeclarationbuilder runs before us, | ||
117 | /// we always "think" that we are recompiling, while this is not necessarily true | 118 | /// we always "think" that we are recompiling, while this is not necessarily true | ||
118 | bool m_actuallyRecompiling; | 119 | bool m_actuallyRecompiling; | ||
119 | 120 | | |||
120 | struct FindVariableResults { | 121 | struct FindVariableResults { | ||
121 | /// Set this to true if you want to catch any variable in the lower AST tree | 122 | /// Set this to true if you want to catch any variable in the lower AST tree | ||
Show All 15 Lines | |||||
137 | FindVariableResults(); | 138 | FindVariableResults(); | ||
138 | }; | 139 | }; | ||
139 | FindVariableResults m_findVariable; | 140 | FindVariableResults m_findVariable; | ||
140 | 141 | | |||
141 | /// The position of the current argument, will only be set inside function calls. | 142 | /// The position of the current argument, will only be set inside function calls. | ||
142 | int m_functionCallParameterPos; | 143 | int m_functionCallParameterPos; | ||
143 | /// Type of the current function, will only be set inside function calls. | 144 | /// Type of the current function, will only be set inside function calls. | ||
144 | KDevelop::FunctionType::Ptr m_currentFunctionType; | 145 | KDevelop::FunctionType::Ptr m_currentFunctionType; | ||
146 | /// The AstNode of the previous function declaration argument | ||||
147 | ParameterAst *m_functionDeclarationPreviousArgument; | ||||
mwolff: ` = nullptr;`
it's otherwise potentially uninitialized | |||||
Should I add that to the one before as well? (m_functionDeclarationPreviousArgument) pprkut: Should I add that to the one before as well? (m_functionDeclarationPreviousArgument) | |||||
sure, or check whether it's inited in a ctor - if not, add it here (but preferrably do that in a separate patch) mwolff: sure, or check whether it's inited in a ctor - if not, add it here (but preferrably do that in… | |||||
148 | /// The AstNode of the previous function call argument | ||||
149 | FunctionCallParameterListElementAst *m_functionCallPreviousArgument; | ||||
145 | 150 | | |||
146 | unsigned int m_currentModifers; | 151 | unsigned int m_currentModifers; | ||
147 | QString m_lastTopStatementComment; | 152 | QString m_lastTopStatementComment; | ||
148 | 153 | | |||
149 | QHash<qint64, ClassDeclaration*> m_types; | 154 | QHash<qint64, ClassDeclaration*> m_types; | ||
150 | QHash<qint64, FunctionDeclaration*> m_functions; | 155 | QHash<qint64, FunctionDeclaration*> m_functions; | ||
151 | QHash<qint64, NamespaceDeclaration*> m_namespaces; | 156 | QHash<qint64, NamespaceDeclaration*> m_namespaces; | ||
152 | QList<KDevelop::QualifiedIdentifier> m_upcomingClassVariables; | 157 | QList<KDevelop::QualifiedIdentifier> m_upcomingClassVariables; | ||
▲ Show 20 Lines • Show All 87 Lines • Show Last 20 Lines |
= nullptr;
it's otherwise potentially uninitialized