diff options
author | Roberto Raggi <qtc-committer@nokia.com> | 2009-02-09 21:00:03 +0100 |
---|---|---|
committer | Roberto Raggi <qtc-committer@nokia.com> | 2009-02-09 21:00:03 +0100 |
commit | 25de88fe61262dccbbbcf41d95f578e6176952ca (patch) | |
tree | b300abfefd40d9a19857a5db298727f9b6ea5843 /src/shared/cplusplus/Scope.cpp | |
parent | 0a9a67cf547701a278f19dbe2b9fb0a70a36cdb8 (diff) | |
download | qt-creator-25de88fe61262dccbbbcf41d95f578e6176952ca.tar.gz |
Fixes: Removed dynamic_cast from Scope.
Diffstat (limited to 'src/shared/cplusplus/Scope.cpp')
-rw-r--r-- | src/shared/cplusplus/Scope.cpp | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/src/shared/cplusplus/Scope.cpp b/src/shared/cplusplus/Scope.cpp index db05d1bdc9..efb6a369ae 100644 --- a/src/shared/cplusplus/Scope.cpp +++ b/src/shared/cplusplus/Scope.cpp @@ -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; } |