@Override
public FileNode buildAST(Collection<ICompilerProblem> problems, String filename)
{
FileNode fileNode = new FileNode(workspace, filename);
PackageNode packageNode = new PackageNode(new IdentifierNode(""), null);
fileNode.addItem(packageNode);
ScopedBlockNode packageContents = packageNode.getScopedNode();
ImportNode importNode = ImportNode.buildImportNode(getBaseClassQName());
packageContents.addItem(importNode);
importNode = ImportNode.buildImportNode("mx.core.IFlexAsset");
packageContents.addItem(importNode);
importNode = ImportNode.buildImportNode("flash.utils.ByteArray");
packageContents.addItem(importNode);
importNode = ImportNode.buildImportNode("flash.display.Shader");
packageContents.addItem(importNode);
// generate the byte array class name
String byteArrayClassName = data.getQName() + byteArrayNamePostfix;
ClassNode classNodeByteArray = new ClassNode(new IdentifierNode(byteArrayClassName));
classNodeByteArray.setBaseClass(new IdentifierNode(getBaseClassName()));
classNodeByteArray.setNamespace(new NamespaceIdentifierNode(INamespaceConstants.public_));
packageContents.addItem(classNodeByteArray);
// generate the pbj class name
String pbjClassName = data.getQName();
ClassNode classNodePbj = new ClassNode(new IdentifierNode(pbjClassName));
classNodePbj.setBaseClass(new IdentifierNode("Shader"));
classNodePbj.addInterface(new IdentifierNode("IFlexAsset"));
classNodePbj.setNamespace(new NamespaceIdentifierNode(INamespaceConstants.public_));
packageContents.addItem(classNodePbj);
// build the constructor
IdentifierNode constructorNameNode = new IdentifierNode(pbjClassName);
constructorNameNode.setReferenceValue(classNodePbj.getDefinition());
FunctionNode constructorNode = new FunctionNode(null, constructorNameNode);
constructorNode.setNamespace(new NamespaceIdentifierNode(INamespaceConstants.public_));
ScopedBlockNode constructorContents = constructorNode.getScopedNode();
// generate: super();
FunctionCallNode superCall = new FunctionCallNode(LanguageIdentifierNode.buildSuper());
constructorContents.addItem(superCall);
// generate: byteCode = new EmbedTest_sphereClassByteArray();
ASToken newToken = new ASToken(ASTokenTypes.TOKEN_KEYWORD_NEW, -1, -1, -1, -1, IASKeywordConstants.NEW);
FunctionCallNode newCall = new FunctionCallNode(newToken, new IdentifierNode(byteArrayClassName));
ASToken assignToken = new ASToken(ASTokenTypes.TOKEN_OPERATOR_ASSIGNMENT, -1, -1, -1, -1, "=");
BinaryOperatorNodeBase assignment = BinaryOperatorNodeBase.create(assignToken, new IdentifierNode("byteCode"), newCall);
constructorContents.addItem(assignment);
classNodePbj.getScopedNode().addItem(constructorNode);
fileNode.runPostProcess(EnumSet.of(PostProcessStep.POPULATE_SCOPE));