StatementListNode result = statementList;
Iterator<PropertyDeclaration> iterator = mxmlDocument.getDeclarationIterator();
while (iterator.hasNext())
{
PropertyDeclaration propertyDeclaration = iterator.next();
if (propertyDeclaration.getInspectable())
{
MetaDataNode inspectableMetaData = AbstractSyntaxTreeUtil.generateMetaData(nodeFactory, INSPECTABLE);
result = nodeFactory.statementList(result, inspectableMetaData);
}
if (!propertyDeclaration.getIdIsAutogenerated() || propertyDeclaration.getBindabilityEnsured())
{
MetaDataNode bindableMetaData = AbstractSyntaxTreeUtil.generateMetaData(nodeFactory, BINDABLE);
result = nodeFactory.statementList(result, bindableMetaData);
}
if (!propertyDeclaration.getIdIsAutogenerated())
{
if(processComments)
{
MetaDataNode propertyDocComment = null;
if(propertyDeclaration.getComment() != null )
{
propertyDocComment = AbstractSyntaxTreeUtil.generateDocComment(nodeFactory, propertyDeclaration.getComment().intern());
}
if (propertyDocComment != null)
{
result = nodeFactory.statementList(result, propertyDocComment);
}
else
{
// when individual classes are listed using doc-classes, properties with id but no comment are not visible. So adding a blank comment.
DocCommentNode docComment =
AbstractSyntaxTreeUtil.generateDocComment(nodeFactory, "<description><![CDATA[]]></description>".intern());
result = nodeFactory.statementList(result, docComment);
}
}
if (generateDocComments && !processComments)
{
DocCommentNode docComment = AbstractSyntaxTreeUtil.generatePrivateDocComment(nodeFactory);
result = nodeFactory.statementList(result, docComment);
}
}
else
{
if (generateDocComments)
{
DocCommentNode docComment = AbstractSyntaxTreeUtil.generatePrivateDocComment(nodeFactory);
result = nodeFactory.statementList(result, docComment);
}
}
TypeExpressionNode typeExpression =
AbstractSyntaxTreeUtil.generateTypeExpression(nodeFactory,
propertyDeclaration.getTypeExpr(), true);
Node variableDefinition =
AbstractSyntaxTreeUtil.generatePublicVariable(context, typeExpression,
propertyDeclaration.getName());
result = nodeFactory.statementList(result, variableDefinition);
}
return result;
}