[Bug 80671] code completion not working in try/catch code blocks
Adam Treat
manyoso at yahoo.com
Fri Mar 11 19:05:06 UTC 2005
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
http://bugs.kde.org/show_bug.cgi?id=80671
manyoso yahoo com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
------- Additional Comments From manyoso yahoo com 2005-03-11 19:04 -------
CVS commit by treat:
* Add support for completion in try/catch blocks
BUGS:80671
M +37 -0 cppcodecompletion.cpp 1.164
M +3 -0 cppcodecompletion.h 1.56
--- kdevelop/languages/cpp/cppcodecompletion.cpp #1.163:1.164
@ -1480,4 +1480,7 @ void CppCodeCompletion::computeContext(
computeContext( ctx, static_cast<SwitchStatementAST*>( stmt ), line, col );
break;
+ case NodeType_TryBlockStatement:
+ computeContext( ctx, static_cast<TryBlockStatementAST*>( stmt ), line, col );
+ break;
case NodeType_DeclarationStatement:
computeContext( ctx, static_cast<DeclarationStatementAST*>( stmt ), line, col );
@ -1554,4 +1557,38 @ void CppCodeCompletion::computeContext(
}
+void CppCodeCompletion::computeContext( SimpleContext*& ctx, TryBlockStatementAST* ast, int line, int col )
+{
+ if ( !inContextScope( ast, line, col ) )
+ return;
+
+ computeContext( ctx, ast->statement(), line, col );
+ computeContext( ctx, ast->catchStatementList(), line, col );
+}
+
+void CppCodeCompletion::computeContext( SimpleContext*& ctx, CatchStatementListAST* ast, int line, int col )
+{
+ if ( !inContextScope( ast, line, col, false, true ) )
+ return;
+
+ QPtrList<CatchStatementAST> l( ast->statementList() );
+ QPtrListIterator<CatchStatementAST> it( l );
+ while ( it.current() )
+ {
+ CatchStatementAST * stmt = it.current();
+ ++it;
+
+ computeContext( ctx, stmt, line, col );
+ }
+}
+
+void CppCodeCompletion::computeContext( SimpleContext*& ctx, CatchStatementAST* ast, int line, int col )
+{
+ if ( !inContextScope( ast, line, col ) )
+ return;
+
+ computeContext( ctx, ast->condition(), line, col );
+ computeContext( ctx, ast->statement(), line, col );
+}
+
void CppCodeCompletion::computeContext( SimpleContext*& ctx, DeclarationStatementAST* ast, int line, int col )
{
--- kdevelop/languages/cpp/cppcodecompletion.h #1.55:1.56
@ -129,4 +129,7 @ private:
void computeContext( SimpleContext*& ctx, WhileStatementAST* ast, int line, int col );
void computeContext( SimpleContext*& ctx, SwitchStatementAST* ast, int line, int col );
+ void computeContext( SimpleContext*& ctx, TryBlockStatementAST* ast, int line, int col );
+ void computeContext( SimpleContext*& ctx, CatchStatementListAST* ast, int line, int col );
+ void computeContext( SimpleContext*& ctx, CatchStatementAST* ast, int line, int col );
void computeContext( SimpleContext*& ctx, DeclarationStatementAST* ast, int line, int col );
void computeContext( SimpleContext*& ctx, ConditionAST* ast, int line, int col );
More information about the KDevelop-devel
mailing list