if (benchmarkHelper != null)
{
benchmarkHelper.startPhase(CompilerBenchmarkHelper.ANALYZE4, unit.getSource().getNameForReporting());
}
TypeTable typeTable = null;
if (symbolTable != null)
{
typeTable = (TypeTable) symbolTable.getContext().getAttribute(AttrTypeTable);
if (typeTable == null)
{
typeTable = new TypeTable(symbolTable);
symbolTable.getContext().setAttribute(AttrTypeTable, typeTable);
}
}
if (unit.hasTypeInfo)
{
for (Map.Entry<String, AbcClass> entry : unit.classTable.entrySet())
{
AbcClass c = entry.getValue();
c.setTypeTable(typeTable);
symbolTable.registerClass(entry.getKey(), c);
}
try
{
symbolTable.registerStyles(unit.styles);
}
catch (StyleConflictException e)
{
// C: assume that StyleConflictException is going to be internationalized...
ThreadLocalToolkit.logError(unit.getSource().getNameForReporting(), e.getLocalizedMessage());
}
evaluateLoaderClassBase(unit, typeTable);
return;
}
ProgramNode node = (ProgramNode) unit.getSyntaxTree();
if (node.state == ProgramNode.Inheritance || node.state == ProgramNode.Else)
{
return;
}
CompilerContext context = unit.getContext();
Context cx = context.getAscContext();
symbolTable.perCompileData.handler = cx.getHandler();
// run ConstantEvaluator
cx.pushScope(node.frame);
ConstantEvaluator analyzer = (ConstantEvaluator) context.removeAttribute("ConstantEvaluator");
node.evaluate(cx, analyzer);
cx.popScope();
if (ThreadLocalToolkit.errorCount() > 0)
{
return;
}
// run -strict and -coach
if (as3Configuration.warnings())
{
cx.pushScope(node.frame);
LintEvaluator lint = new LintEvaluator(cx, unit.getSource().getName(), warnMap);
node.evaluate(cx, lint);
cx.popScope();
lint.simpleLogWarnings(cx, coachWarningsAsErrors);
// if we want to go back to the verbose style of warnings, uncomment the line below and
// comment out the line above
//lint.logWarnings(context.cx);
lint.clear();
}
if (ThreadLocalToolkit.errorCount() > 0)
{
return;
}
// last step: collect class definitions, add them to the symbol table and the CompilationUnit
Map classMap = typeTable.createClasses(node.clsdefs, unit.topLevelDefinitions);
for (Iterator i = classMap.keySet().iterator(); i.hasNext();)
{
String className = (String) i.next();
AbcClass c = (AbcClass) classMap.get(className);
symbolTable.registerClass(className, c);