diff options
author | Roberto Raggi <roberto.raggi@nokia.com> | 2010-08-13 10:12:21 +0200 |
---|---|---|
committer | Roberto Raggi <roberto.raggi@nokia.com> | 2010-08-13 10:12:21 +0200 |
commit | cee87ece252eb5703418449dd0a5bcdaf1494758 (patch) | |
tree | 0f4666faa81b45c62f4fa465245ffd77dc110df9 /src/shared/cplusplus/Bind.cpp | |
parent | 93bbd32c7bd02fce4f608593b3d43d8ead6d8957 (diff) | |
download | qt-creator-cee87ece252eb5703418449dd0a5bcdaf1494758.tar.gz |
Added a way to bind TranslationUnitAST nodes.
Diffstat (limited to 'src/shared/cplusplus/Bind.cpp')
-rw-r--r-- | src/shared/cplusplus/Bind.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/shared/cplusplus/Bind.cpp b/src/shared/cplusplus/Bind.cpp index 3856b3cae5..1d34971ac0 100644 --- a/src/shared/cplusplus/Bind.cpp +++ b/src/shared/cplusplus/Bind.cpp @@ -68,8 +68,6 @@ Bind::Bind(TranslationUnit *unit) _name(0), _declaratorId(0) { - if (unit->ast()) - translationUnit(unit->ast()->asTranslationUnit()); } Scope *Bind::currentScope() const @@ -84,6 +82,13 @@ Scope *Bind::switchScope(Scope *scope) return previousScope; } +void Bind::operator()(TranslationUnitAST *ast, Namespace *globalNamespace) +{ + Scope *previousScope = switchScope(globalNamespace); + translationUnit(ast); + (void) switchScope(previousScope); +} + void Bind::statement(StatementAST *ast) { accept(ast); @@ -703,12 +708,9 @@ void Bind::translationUnit(TranslationUnitAST *ast) if (! ast) return; - Namespace *globalNamespace = control()->newNamespace(0, 0); - Scope *previousScope = switchScope(globalNamespace); for (DeclarationListAST *it = ast->declaration_list; it; it = it->next) { this->declaration(it->value); } - (void) switchScope(previousScope); } bool Bind::visit(ObjCProtocolRefsAST *ast) |