problemQuery.clear();
}
final IFileSpecification sourceFileSpec = new FileSpecification(sourceFilename);
workspace.fileAdded(sourceFileSpec);
final ICompilationUnit cu = ASCompilationUnit.createMainCompilationUnitForASC(
applicationProject,
sourceFileSpec,
this);
mainUnits.add(cu);
unitOrdering.put(cu,unitOrdering.size());
// add compilation unit to project
applicationProject.addCompilationUnit(cu);
applicationProject.updatePublicAndInternalDefinitions(Collections.singletonList(cu));
// The logic that re-parses a garbage collected syntax tree, does not
// know about the files included with the -in option, so we'll pin
// the syntax tree here so we know we will never need to re-parse the
// the synax tree for the root compilation unit.
rootedSyntaxTrees.add(cu.getSyntaxTreeRequest().get().getAST());
// syntax errors
for (final ICompilationUnit compilationUnit : applicationProject.getCompilationUnits())
{
final ICompilerProblem[] problems = compilationUnit.getSyntaxTreeRequest().get().getProblems();
problemQuery.addAll(problems);
}
// Parse trees
if ( getShowParseTrees() )
{
final String outputSyntaxFilename = FilenameUtils.removeExtension(sourceFilename).concat(".p");
try
{
PrintWriter syntaxFile = new PrintWriter(outputSyntaxFilename);
final IASNode ast = cu.getSyntaxTreeRequest().get().getAST();
if(ast instanceof FileNode)
{
// Parse the full tree and add the new problems found in the
// function bodies into the problem collection.
final FileNode fileNode = (FileNode)ast;