public void visit(TypeDeclaration theTypeDecl)
{
Map<String, String> annotations= theTypeDecl.getAnnotations();
ClassUnit classUnit= project.getClassUnit(theTypeDecl.getType());
lastChar= '\0';
currentNode= null;
depth= 0;
typeDecl= theTypeDecl;
boolean isInterface= Modifier.isInterface(typeDecl.getAccess());
String type= isInterface ? "Interface" : "Class";
print("qx." + type + ".define(\"");
print(normalizeExpression(theTypeDecl.getClassName()));
println("\", ");
println("{");
depth++;
if (classUnit.getSuperUnit() != null)
{
String superUnitName= normalizeExpression(classUnit.getSuperUnit().getName());
print("extend: " + superUnitName);
println(",");
}
else
{
if (!classUnit.getName().equals("java.lang.Object"))
{
print("extend: java_lang_Object");
}
else
{
print("extend: qx.core.Object");
}
println(",");
}
if (!classUnit.getName().equals("java.lang.Object"))
println("construct: function(){},");
classUnit.setData(reset());
List fields= theTypeDecl.getFields();
for (int i= 0; i < fields.size(); i++)
{
VariableDeclaration decl= (VariableDeclaration) fields.get(i);
if (decl.getLocation() == VariableDeclaration.NON_LOCAL)
{
// if (Modifier.isStatic(decl.getModifiers()))
// continue;
// indent();
decl.visit(this);
//println(",");
}
}
depth--;
// String superType= null;
//
// if (theTypeDecl.getSuperType() != null && !Modifier.isInterface(theTypeDecl.getAccess()))
// {
// superType= Project.getSingleton().getSignature(theTypeDecl.getSuperType().getClassName()).getCommentedId();
// }
// for (int i= 0; i < fields.size(); i++)
// {
// VariableDeclaration decl= (VariableDeclaration) fields.get(i);
//
// if (!Modifier.isStatic(decl.getModifiers()))
// continue;
// indent();
// decl.visit(this);
// println(";");
// }
depth++;
MethodDeclaration[] methods= theTypeDecl.getMethods();
List<String> processedMethods= new ArrayList<String>();
for (int i= 0; i < methods.length; i++)
{
MethodDeclaration method= methods[i];
currentMethodDeclaration= method;
try
{
String normalizeExpression= normalizeExpression(Project.getSingleton().getSignature(method.getMethodBinding().toString()).relative());
if (!processedMethods.contains(normalizeExpression))
{
processedMethods.add(normalizeExpression);
method.visit(this);
}
else
System.out.println("duplicado!");
// System.out.println("llego!");
}
catch (RuntimeException ex)
{
throw Utils.generateException(ex, method, currentNode);
}
}
processedMethods.clear();
depth--;
reset();
depth++;
//addSuperMethodsDefinition();
depth--;
classUnit.setData(classUnit.getData() + reset());
}