@Override
public void emitIdentifier(IIdentifierNode node)
{
ICompilerProject project = getWalker().getProject();
IClassNode cnode = (IClassNode) node
.getAncestorOfType(IClassNode.class);
IDefinition def = ((IIdentifierNode) node).resolve(project);
ITypeDefinition type = ((IIdentifierNode) node).resolveType(project);
IASNode pnode = node.getParent();
ASTNodeID inode = pnode.getNodeID();
boolean writeSelf = false;
if (cnode != null)
{
IDefinitionNode[] members = cnode.getAllMemberNodes();
for (IDefinitionNode mnode : members)
{
if ((type != null && type.getQualifiedName().equalsIgnoreCase(
IASLanguageConstants.Function))
|| (def != null && def.getQualifiedName()
.equalsIgnoreCase(mnode.getQualifiedName())))
{
if (!(pnode instanceof FunctionNode)
&& inode != ASTNodeID.MemberAccessExpressionID)
{
writeSelf = true;
break;
}
else if (inode == ASTNodeID.MemberAccessExpressionID
&& !def.isStatic())
{
String tname = type.getQualifiedName();
writeSelf = !tname.equalsIgnoreCase(cnode
.getQualifiedName())
&& !tname.equals(IASLanguageConstants.Function);
break;
}
}
}
}
boolean isRunningInTestMode = cnode != null
&& cnode.getQualifiedName().equalsIgnoreCase("FalconTest_A");
if (writeSelf && !isRunningInTestMode)
{
write(JSGoogEmitterTokens.SELF);
write(ASEmitterTokens.MEMBER_ACCESS);
}
else
{
String pname = (type != null) ? type.getPackageName() : "";
if (cnode != null
&& pname != ""
&& !pname.equalsIgnoreCase(cnode.getPackageName())
&& inode != ASTNodeID.ArgumentID
&& inode != ASTNodeID.VariableID
&& inode != ASTNodeID.TypedExpressionID)
{
write(pname);