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

List:       kde-commits
Subject:    [kdev-qmljs] /: Don't crash if we failed to parse a file.
From:       Milian Wolff <mail () milianw ! de>
Date:       2013-01-26 13:05:56
Message-ID: 20130126130556.DDDBFA6091 () git ! kde ! org
[Download RAW message or body]

Git commit 271c3e51ecedeeca0fe7a4b2e0150feb65c789fc by Milian Wolff.
Committed on 26/01/2013 at 14:05.
Pushed by mwolff into branch 'master'.

Don't crash if we failed to parse a file.

In such cases we must not run the use builder.

M  +10   -4    qmljsparsejob.cpp

http://commits.kde.org/kdev-qmljs/271c3e51ecedeeca0fe7a4b2e0150feb65c789fc

diff --git a/qmljsparsejob.cpp b/qmljsparsejob.cpp
index ecbe3a0..2d09bc9 100644
--- a/qmljsparsejob.cpp
+++ b/qmljsparsejob.cpp
@@ -77,6 +77,16 @@ void QmlJsParseJob::run()
 
         DeclarationBuilder builder(&session);
         context = builder.build(document(), session.ast(), context);
+
+        if (abortRequested()) {
+            abortJob();
+            return;
+        }
+
+        if ( context && minimumFeatures() & TopDUContext::AllDeclarationsContextsAndUses ) {
+            UseBuilder useBuilder(&session);
+            useBuilder.buildUses(session.ast());
+        }
     }
 
     if (abortRequested()) {
@@ -89,10 +99,6 @@ void QmlJsParseJob::run()
         file->setLanguage(ParseSession::languageString());
         context = new TopDUContext(document(), RangeInRevision(0, 0, INT_MAX, INT_MAX), file);
         DUChain::self()->addDocumentChain(context);
-    } else if ( minimumFeatures() & TopDUContext::AllDeclarationsContextsAndUses ) {
-        // build uses
-        UseBuilder useBuilder(&session);
-        useBuilder.buildUses(session.ast());
     }
 
     setDuChain(context);
[prev in list] [next in list] [prev in thread] [next in thread] 

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