Commit 25de88fe authored by Roberto Raggi's avatar Roberto Raggi
Browse files

Fixes: Removed dynamic_cast from Scope.

parent 0a9a67cf
......@@ -148,27 +148,45 @@ Scope *Scope::enclosingBlockScope() const
}
bool Scope::isNamespaceScope() const
{ return dynamic_cast<const Namespace *>(_owner) != 0; }
{
if (_owner)
return _owner->isNamespace();
return false;
}
bool Scope::isClassScope() const
{ return dynamic_cast<const Class *>(_owner) != 0; }
{
if (_owner)
return _owner->isClass();
return false;
}
bool Scope::isEnumScope() const
{ return dynamic_cast<const Enum *>(_owner) != 0; }
{
if (_owner)
return _owner->isEnum();
return false;
}
bool Scope::isBlockScope() const
{ return dynamic_cast<const Block *>(_owner) != 0; }
{
if (_owner)
return _owner->isBlock();
return false;
}
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 false;
}
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 false;
}
......
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