Commit dd7aa0d5 authored by Marius Wachtler's avatar Marius Wachtler

Cache SourceInfo::getScopeInfo

parent ceb3e449
...@@ -63,6 +63,7 @@ SourceInfo::SourceInfo(BoxedModule* m, ScopingAnalysis* scoping, FutureFlags fut ...@@ -63,6 +63,7 @@ SourceInfo::SourceInfo(BoxedModule* m, ScopingAnalysis* scoping, FutureFlags fut
std::vector<AST_stmt*> body, std::string fn) std::vector<AST_stmt*> body, std::string fn)
: parent_module(m), : parent_module(m),
scoping(scoping), scoping(scoping),
scope_info(NULL),
future_flags(future_flags), future_flags(future_flags),
ast(ast), ast(ast),
cfg(NULL), cfg(NULL),
......
...@@ -127,7 +127,9 @@ Box* SourceInfo::getDocString() { ...@@ -127,7 +127,9 @@ Box* SourceInfo::getDocString() {
} }
ScopeInfo* SourceInfo::getScopeInfo() { ScopeInfo* SourceInfo::getScopeInfo() {
return scoping->getScopeInfoForNode(ast); if (!scope_info)
scope_info = scoping->getScopeInfoForNode(ast);
return scope_info;
} }
LivenessAnalysis* SourceInfo::getLiveness() { LivenessAnalysis* SourceInfo::getLiveness() {
......
...@@ -328,6 +328,7 @@ class SourceInfo { ...@@ -328,6 +328,7 @@ class SourceInfo {
public: public:
BoxedModule* parent_module; BoxedModule* parent_module;
ScopingAnalysis* scoping; ScopingAnalysis* scoping;
ScopeInfo* scope_info;
FutureFlags future_flags; FutureFlags future_flags;
AST* ast; AST* ast;
CFG* cfg; CFG* cfg;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment