Skip to content
Snippets Groups Projects
Commit 25de88fe authored by Roberto Raggi's avatar Roberto Raggi
Browse files

Fixes: Removed dynamic_cast from Scope.

parent 0a9a67cf
No related branches found
No related tags found
No related merge requests found
...@@ -148,27 +148,45 @@ Scope *Scope::enclosingBlockScope() const ...@@ -148,27 +148,45 @@ Scope *Scope::enclosingBlockScope() const
} }
bool Scope::isNamespaceScope() const bool Scope::isNamespaceScope() const
{ return dynamic_cast<const Namespace *>(_owner) != 0; } {
if (_owner)
return _owner->isNamespace();
return false;
}
bool Scope::isClassScope() const bool Scope::isClassScope() const
{ return dynamic_cast<const Class *>(_owner) != 0; } {
if (_owner)
return _owner->isClass();
return false;
}
bool Scope::isEnumScope() const bool Scope::isEnumScope() const
{ return dynamic_cast<const Enum *>(_owner) != 0; } {
if (_owner)
return _owner->isEnum();
return false;
}
bool Scope::isBlockScope() const bool Scope::isBlockScope() const
{ return dynamic_cast<const Block *>(_owner) != 0; } {
if (_owner)
return _owner->isBlock();
return false;
}
bool Scope::isPrototypeScope() const bool Scope::isPrototypeScope() const
{ {
if (const Function *f = dynamic_cast<const Function *>(_owner)) Function *f = 0;
if (_owner && 0 != (f = _owner->asFunction()))
return f->arguments() == this; return f->arguments() == this;
return false; return false;
} }
bool Scope::isFunctionScope() const bool Scope::isFunctionScope() const
{ {
if (const Function *f = dynamic_cast<const Function *>(_owner)) Function *f = 0;
if (_owner && 0 != (f = _owner->asFunction()))
return f->arguments() != this; return f->arguments() != this;
return false; return false;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment