* scope is not in a ClassDefinition
*/
public ClassDefinitionBase getContainingClass()
{
ASScope scope = this;
ScopedDefinitionBase sdb = null;
while (scope != null && sdb == null)
{
// Walk up the scope chain until we find the first scope with a definition.
// stuff like catch, or with scopes will have no definition associated with them
sdb = scope.getDefinition();
scope = scope.getContainingScope();
}
if (sdb instanceof ClassDefinitionBase)
return (ClassDefinitionBase)sdb;
else if (sdb != null)
return (ClassDefinitionBase)sdb.getAncestorOfType(ClassDefinitionBase.class);
return null;
}