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

List:       kde-commits
Subject:    [kdev-qmljs] duchain: Don't crash when encountering an empty function expression (having no body)
From:       Denis Steckelmacher <steckdenis () yahoo ! fr>
Date:       2014-04-15 13:38:40
Message-ID: E1Wa3ZQ-000344-1G () scm ! kde ! org
[Download RAW message or body]

Git commit d828ab03d45fb3cd8ec452afdf44c858b1307270 by Denis Steckelmacher.
Committed on 13/04/2014 at 18:44.
Pushed by dsteckelmacher into branch 'master'.

Don't crash when encountering an empty function expression (having no body)

M  +1    -1    duchain/expressionvisitor.cpp

http://commits.kde.org/kdev-qmljs/d828ab03d45fb3cd8ec452afdf44c858b1307270

diff --git a/duchain/expressionvisitor.cpp b/duchain/expressionvisitor.cpp
index 42301f2..a7e0ba6 100644
--- a/duchain/expressionvisitor.cpp
+++ b/duchain/expressionvisitor.cpp
@@ -128,7 +128,7 @@ bool ExpressionVisitor::visit(QmlJS::AST::IdentifierExpression* node)
 bool ExpressionVisitor::visit(QmlJS::AST::FunctionExpression* node)
 {
     DUChainReadLocker lock;
-    QmlJS::AST::SourceLocation location = node->body->firstSourceLocation();
+    QmlJS::AST::SourceLocation location = node->lbraceToken;
 
     // Find the anonymous declaration corresponding to the function. This is
     // the owner of the current context (function expressions create new contexts)
[prev in list] [next in list] [prev in thread] [next in thread] 

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