forked from qt-creator/qt-creator
Added a way to bind TranslationUnitAST nodes.
This commit is contained in:
@@ -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)
|
||||
|
Reference in New Issue
Block a user