diff --git a/src/shared/cplusplus/Bind.cpp b/src/shared/cplusplus/Bind.cpp index a7dc27f5510652617a0d66be2335692dd0e2e8b3..178aa9fe107c9c6330bb69f8f6732781b546c6c4 100644 --- a/src/shared/cplusplus/Bind.cpp +++ b/src/shared/cplusplus/Bind.cpp @@ -64,6 +64,7 @@ namespace { bool debug_todo = false; } Bind::Bind(TranslationUnit *unit) : ASTVisitor(unit), + _currentScope(0), _currentExpression(0), _currentName(0) { @@ -71,6 +72,18 @@ Bind::Bind(TranslationUnit *unit) translationUnit(unit->ast()->asTranslationUnit()); } +Scope *Bind::currentScope() const +{ + return _currentScope; +} + +Scope *Bind::switchScope(Scope *scope) +{ + Scope *previousScope = _currentScope; + _currentScope = scope; + return previousScope; +} + void Bind::statement(StatementAST *ast) { accept(ast); diff --git a/src/shared/cplusplus/Bind.h b/src/shared/cplusplus/Bind.h index d96c2cbd7fc230114b1e541920b21a3f245db02e..f47b96a08666d114fb2255c2330ba3977f9f02d4 100644 --- a/src/shared/cplusplus/Bind.h +++ b/src/shared/cplusplus/Bind.h @@ -72,6 +72,9 @@ public: FullySpecifiedType coreDeclarator(CoreDeclaratorAST *ast, const FullySpecifiedType &init); FullySpecifiedType postfixDeclarator(PostfixDeclaratorAST *ast, const FullySpecifiedType &init); + Scope *currentScope() const; + Scope *switchScope(Scope *scope); + protected: using ASTVisitor::translationUnit; @@ -266,6 +269,7 @@ protected: virtual bool visit(ArrayDeclaratorAST *ast); private: + Scope *_currentScope; ExpressionTy _currentExpression; const Name *_currentName; FullySpecifiedType _currentType;