[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdevelop/parts/cppsupport
From:       Roberto Raggi <roberto () kdevelop ! org>
Date:       2003-04-18 14:05:27
[Download RAW message or body]

CVS commit by raggi: 

small improvement


  M +28 -4     cppcodecompletion.cpp   1.87
  M +1 -0      cppcodecompletion.h   1.38


--- kdevelop/parts/cppsupport/cppcodecompletion.cpp  #1.86:1.87
@@ -1402,4 +1402,5 @@ void CppCodeCompletion::computeContext( 
 void CppCodeCompletion::computeContext( SimpleContext*& ctx, ForStatementAST* ast, \
int line, int col )  {
+    computeContext( ctx, ast->condition(), line, col );
     computeContext( ctx, ast->statement(), line, col );
 }
@@ -1407,4 +1408,5 @@ void CppCodeCompletion::computeContext( 
 void CppCodeCompletion::computeContext( SimpleContext*& ctx, DoStatementAST* ast, \
int line, int col )  {
+    //computeContext( ctx, ast->condition(), line, col );
     computeContext( ctx, ast->statement(), line, col );
 }
@@ -1412,4 +1414,5 @@ void CppCodeCompletion::computeContext( 
 void CppCodeCompletion::computeContext( SimpleContext*& ctx, WhileStatementAST* ast, \
int line, int col )  {
+    computeContext( ctx, ast->condition(), line, col );
     computeContext( ctx, ast->statement(), line, col );
 }
@@ -1417,4 +1420,5 @@ void CppCodeCompletion::computeContext( 
 void CppCodeCompletion::computeContext( SimpleContext*& ctx, SwitchStatementAST* \
ast, int line, int col )  {
+    computeContext( ctx, ast->condition(), line, col );
     computeContext( ctx, ast->statement(), line, col );
 }
@@ -1457,4 +1461,25 @@ void CppCodeCompletion::computeContext( 
 }
 
+void CppCodeCompletion::computeContext( SimpleContext*& ctx, ConditionAST* ast, int \
line, int col ) +{
+    if( !ast->typeSpec() || !ast->declarator() || !ast->declarator()->declaratorId() \
) +        return;
+    
+    int startLine, startColumn;
+    int endLine, endColumn;
+    ast->getStartPosition( &startLine, &startColumn );
+    ast->getEndPosition( &endLine, &endColumn );
+        
+    if( line < startLine || (line == startLine && col <= startColumn) )
+        return;
+    
+    QString type = typeName( ast->typeSpec()->text() );
+    SimpleVariable var;
+    var.type = type;
+    var.name = toSimpleName( ast->declarator()->declaratorId() );
+    ctx->add( var );
+    kdDebug(9007) << "add variable " << var.name << " with type " << var.type << \
endl;     +}
+
 FunctionDefinitionAST * CppCodeCompletion::functionDefinition( AST* node )
 {
@@ -1524,5 +1548,5 @@ void CppCodeCompletion::computeRecoveryP
         {
             TypeSpecifierAST* typeSpec = ast->typeSpec();
-            InitDeclaratorListAST* declarators = ast->initDeclaratorList();
+            //InitDeclaratorListAST* declarators = ast->initDeclaratorList();
 
             if( typeSpec )

--- kdevelop/parts/cppsupport/cppcodecompletion.h  #1.37:1.38
@@ -91,4 +91,5 @@ private:
     void computeContext( SimpleContext*& ctx, SwitchStatementAST* 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 );  
     QString getText( int startLine, int startColumn, int endLine, int endColumn );


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic