*/
private AccessorDefinition findCorrespondingAccessor(ASScope scope, ICompilerProject project)
{
final String name = getBaseName();
final INamespaceReference namespaceReference = getNamespaceReference();
final boolean isStatic = isStatic();
// If the namespace is bad and dosn't resolve, then we can't find corresponding accessor.
final INamespaceDefinition thisNamespaceDef = namespaceReference.resolveNamespaceReference(project);
if (thisNamespaceDef == null)
return null;
final boolean isBindable = ((NamespaceDefinition)thisNamespaceDef).getAETNamespace().getName().equals(
BindableHelper.bindableNamespaceDefinition.getAETNamespace().getName());
final IDefinitionSet definitionSet = scope.getLocalDefinitionSetByName(name);
if (definitionSet == null)
return null;
final int n = definitionSet.getSize();
for (int i = 0; i < n; i++)
{
IDefinition d = definitionSet.getDefinition(i);
if (d instanceof IAccessorDefinition)
{
final IAccessorDefinition definition = (IAccessorDefinition)d;
// If this is a static accessor, we want another static accessor.
// If this is an instance accessor, we want another instance accessor.
if (definition.isStatic() == isStatic)
{
// If this is a getter, we want a setter, and vice versa.
if (this instanceof IGetterDefinition && definition instanceof ISetterDefinition ||
this instanceof ISetterDefinition && definition instanceof IGetterDefinition)
{
INamespaceReference testDefRef = definition.getNamespaceReference();
INamespaceDefinition testNamespaceDef = testDefRef.resolveNamespaceReference(project);
final boolean testBindable = ((NamespaceDefinition)testNamespaceDef).getAETNamespace().getName().equals(
BindableHelper.bindableNamespaceDefinition.getAETNamespace().getName());
/* aharui: namespaces shouldn't have to match. A subclass may only override
* one of the protected methods, and it was legal to have a public getter with
* a protected setter and other combinations like that. Either both