IDefinition tagDef = builder.getFileScope().resolveTagToDefinition(rootTag);
// Report a problem if the root tag doesn't map to a definition.
if (tagDef == null)
{
ICompilerProblem problem = new MXMLUnresolvedTagProblem(rootTag);
builder.addProblem(problem);
return;
}
// Report a problem if that definition isn't for a class.
if (!(tagDef instanceof IClassDefinition))
{
ICompilerProblem problem = new MXMLNotAClassProblem(rootTag, tagDef.getQualifiedName());
builder.addProblem(problem);
return;
}
IClassDefinition tagDefinition = (IClassDefinition)tagDef;
// Report a problem if that class is final.
if (tagDefinition != null && tagDefinition.isFinal())
{
ICompilerProblem problem = new MXMLFinalClassProblem(rootTag, tagDef.getQualifiedName());
builder.addProblem(problem);
return;
}
// Report a problem is that class's constructor has required parameters.
IFunctionDefinition constructor = tagDefinition.getConstructor();
if (constructor != null && constructor.hasRequiredParameters())
{
ICompilerProblem problem = new MXMLConstructorHasParametersProblem(rootTag, tagDef.getQualifiedName());
builder.addProblem(problem);
return;
}
documentNode = new MXMLDocumentNode(this);