From 47069717f82291e3c34a71b7ada44d26731248ee Mon Sep 17 00:00:00 2001 From: Roberto Raggi Date: Thu, 12 Aug 2010 16:30:43 +0200 Subject: [PATCH] Added Bind::switchScope() and Bind::currentScope(). --- src/shared/cplusplus/Bind.cpp | 13 +++++++++++++ src/shared/cplusplus/Bind.h | 4 ++++ 2 files changed, 17 insertions(+) diff --git a/src/shared/cplusplus/Bind.cpp b/src/shared/cplusplus/Bind.cpp index a7dc27f5510..178aa9fe107 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 d96c2cbd7fc..f47b96a0866 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;