Commit e4a7b064 authored by Christian Kamm's avatar Christian Kamm

C++: Fix a crash in debug builds when rewriting functions.

Change-Id: I35266b69d1cc433c4d9176cc849efd03ea1cc1cd
Reviewed-by: default avatarRoberto Raggi <roberto.raggi@nokia.com>
parent bf9782e3
......@@ -237,6 +237,11 @@ void Symbol::setScope(Scope *scope)
_scope = scope;
}
void Symbol::resetScope()
{
_scope = 0;
}
Namespace *Symbol::enclosingNamespace() const
{
for (Scope *s = _scope; s; s = s->enclosingScope()) {
......
......@@ -291,6 +291,7 @@ public:
Block *enclosingBlock() const;
void setScope(Scope *enclosingScope); // ### make me private
void resetScope(); // ### make me private
void setSourceLocation(unsigned sourceLocation, TranslationUnit *translationUnit); // ### make me private
void visitSymbol(SymbolVisitor *visitor);
......
......@@ -151,6 +151,9 @@ public:
newArg->setName(rewrite->rewriteName(arg->name()));
newArg->setType(rewrite->rewriteType(arg->type()));
// the copy() call above set the scope to 'type'
// reset it to 0 before adding addMember to avoid assert
newArg->resetScope();
funTy->addMember(newArg);
}
......
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