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

List:       kde-commits
Subject:    playground/devtools/kdevelop4-extra-plugins/php/duchain
From:       Milian Wolff <mail () milianw ! de>
Date:       2009-05-22 13:19:20
Message-ID: 1242998360.434672.15652.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 971441 by mwolff:

add helper functions which make it easier to report errors which encompass multiple \
nodes

 M  +20 -2     contextbuilder.cpp  
 M  +8 -1      contextbuilder.h  


--- trunk/playground/devtools/kdevelop4-extra-plugins/php/duchain/contextbuilder.cpp \
#971440:971441 @@ -274,13 +274,31 @@
 
 void ContextBuilder::reportError(const QString& errorMsg, AstNode* node)
 {
+    reportError(errorMsg, editor()->findRange(node).textRange());
+}
+
+void ContextBuilder::reportError(const QString& errorMsg, QList< Php::AstNode* > \
nodes) +{
+    KTextEditor::Range range = KTextEditor::Range::invalid();
+    foreach ( AstNode* node, nodes ) {
+        if ( !range.isValid() ) {
+            range.setRange( editor()->findRange(node).textRange() );
+        } else {
+            range.expandToRange( editor()->findRange(node).textRange() );
+        }
+    }
+    reportError(errorMsg, range);
+}
+
+void ContextBuilder::reportError(const QString& errorMsg, KTextEditor::Range range)
+{
     KDevelop::Problem *p = new KDevelop::Problem();
     p->setSource(KDevelop::ProblemData::DUChainBuilder);
     p->setDescription(errorMsg);
-    p->setFinalLocation(KDevelop::DocumentRange(editor()->currentUrl().str(), \
editor()->findRange(node).textRange())); +    \
p->setFinalLocation(KDevelop::DocumentRange(editor()->currentUrl().str(), range));  {
         DUChainWriteLocker lock(DUChain::lock());
-        kDebug() << "Problem" << p->description();
+        kDebug() << "Problem" << p->description() << p->finalLocation();
         currentContext()->topContext()->addProblem(KDevelop::ProblemPointer(p));
     }
 }
--- trunk/playground/devtools/kdevelop4-extra-plugins/php/duchain/contextbuilder.h \
#971440:971441 @@ -74,7 +74,14 @@
 
     virtual void classContextOpened(KDevelop::DUContext* context);
 
-    virtual void reportError(const QString& errorMsg, AstNode* node);
+    /// Report @p errorMsg with the range of @p node
+    /// @see void reportError(const QString& errorMsg, KTextEditor::Range range);
+    void reportError(const QString& errorMsg, AstNode* node);
+    /// Report @p errorMsg with the range encompassing all nodes in @p nodes
+    /// @see void reportError(const QString& errorMsg, KTextEditor::Range range);
+    void reportError(const QString& errorMsg, QList<AstNode*> nodes);
+    /// Report @p errorMsg with range @p range
+    void reportError(const QString& errorMsg, KTextEditor::Range range);
 
     KDevelop::Declaration* findDeclarationImport(DeclarationType declarationType, \
                IdentifierAst* node);
     KDevelop::Declaration* findDeclarationImport(DeclarationType declarationType, \
VariableIdentifierAst* node);


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

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