[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kdev-ruby/gsoc] duchain/builders: Visit the method call arguments even if the method that is being
From: Miquel_Sabaté <mikisabate () gmail ! com>
Date: 2012-08-16 8:59:50
Message-ID: 20120816085950.B1566A6094 () git ! kde ! org
[Download RAW message or body]
Git commit 9e312c6fb3e86269572f60abb8028475a876d7d6 by Miquel Sabaté.
Committed on 16/08/2012 at 10:55.
Pushed by mssola into branch 'gsoc'.
Visit the method call arguments even if the method that is being called hasn't been found
M +7 -7 duchain/builders/declarationbuilder.cpp
M +3 -1 duchain/builders/usebuilder.cpp
http://commits.kde.org/kdev-ruby/9e312c6fb3e86269572f60abb8028475a876d7d6
diff --git a/duchain/builders/declarationbuilder.cpp b/duchain/builders/declarationbuilder.cpp
index 84e429c..6ba6b71 100644
--- a/duchain/builders/declarationbuilder.cpp
+++ b/duchain/builders/declarationbuilder.cpp
@@ -563,14 +563,12 @@ void DeclarationBuilder::visitMethodCall(RubyAst *node)
ExpressionVisitor v(currentContext(), m_editor);
v.visitNode(node);
+ DeclarationPointer lastMethod = v.lastDeclaration();
/* Let's take a look at the method arguments */
- DeclarationPointer lastMethod = v.lastDeclaration();
- if (lastMethod) {
- lock.unlock();
- visitMethodCallArgs(node, lastMethod);
- lock.lock();
- }
+ lock.unlock();
+ visitMethodCallArgs(node, lastMethod);
+ lock.lock();
/* And last but not least, go for the block */
node->tree = aux->cond;
@@ -850,7 +848,9 @@ void DeclarationBuilder::visitMethodCallArgs(RubyAst *mc, DeclarationPointer las
int total, left = 0, right = 0;
bool mark = false, starSeen = false;
- DUContext *argCtx = DUChainUtils::getArgumentContext(lastMethod.data());
+ DUContext *argCtx = NULL;
+ if (lastMethod.data())
+ argCtx = DUChainUtils::getArgumentContext(lastMethod.data());
if (!argCtx || !lastMethod->type<FunctionType>()) {
/*
* We couldn't get enough info, visit the list of parameters as a
diff --git a/duchain/builders/usebuilder.cpp b/duchain/builders/usebuilder.cpp
index 261616c..0798c35 100644
--- a/duchain/builders/usebuilder.cpp
+++ b/duchain/builders/usebuilder.cpp
@@ -116,8 +116,10 @@ void UseBuilder::visitMethodCallMembers(RubyAst *node)
// And this is the loop that does the dirty job.
for (Node *aux = node->tree; aux && ctx; aux = aux->next) {
node->tree = aux;
- if (node->tree->kind != token_object)
+ if (node->tree->kind != token_object) {
+ // i.e. visit "a" and "b" from (a - b).bytesize
UseBuilderBase::visitNode(node);
+ }
range = editorFindRange(node, node);
ev.setContext(ctx);
ev.visitNode(node);
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic