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

List:       kde-commits
Subject:    [kdev-ruby] duchain/builders: Always create context for the function body, even if it's empty.
From:       Alexander Dymo <adymo () kdevelop ! org>
Date:       2012-10-26 14:02:09
Message-ID: 20121026140209.62B2DA6078 () git ! kde ! org
[Download RAW message or body]

Git commit aa42b745c80b176320ae2ed478ec5ba3c371d305 by Alexander Dymo.
Committed on 26/10/2012 at 15:59.
Pushed by dymo into branch 'master'.

Always create context for the function body, even if it's empty.
This is what c++ does and this is what other plugins (like filetemplates) rely on.

M  +2    -2    duchain/builders/contextbuilder.cpp

http://commits.kde.org/kdev-ruby/aa42b745c80b176320ae2ed478ec5ba3c371d305

diff --git a/duchain/builders/contextbuilder.cpp b/duchain/builders/contextbuilder.cpp
index b2073c6..cc59197 100644
--- a/duchain/builders/contextbuilder.cpp
+++ b/duchain/builders/contextbuilder.cpp
@@ -195,8 +195,8 @@ void ContextBuilder::visitMethodStatement(RubyAst *node)
     }
 
     node->tree = aux->l;
+    DUContext *body = openContext(node, DUContext::Other, &name);
     if (node->tree && is_valid(node->tree)) {
-        DUContext *body = openContext(node, DUContext::Other, &name);
         if (compilingContexts()) {
             DUChainWriteLocker wlock(DUChain::lock());
             if (params)
@@ -204,8 +204,8 @@ void ContextBuilder::visitMethodStatement(RubyAst *node)
             body->setInSymbolTable(false);
         }
         visitBody(node);
-        closeContext();
     }
+    closeContext();
     node->tree = aux;
 }
 
[prev in list] [next in list] [prev in thread] [next in thread] 

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