261 } 262 return fn; 263 } 264 265 @Override 266 public String toString() { 267 return "'Optimistic Type Assignment'"; 268 } 269 } 270 271 static final CompilationPhase OPTIMISTIC_TYPE_ASSIGNMENT_PHASE = new OptimisticTypeAssignmentPhase(); 272 273 private static final class LocalVariableTypeCalculationPhase extends CompilationPhase { 274 @Override 275 FunctionNode transform(final Compiler compiler, final CompilationPhases phases, final FunctionNode fn) { 276 final FunctionNode newFunctionNode = transformFunction(fn, new LocalVariableTypesCalculator(compiler)); 277 final ScriptEnvironment senv = compiler.getScriptEnvironment(); 278 final PrintWriter err = senv.getErr(); 279 280 //TODO separate phase for the debug printouts for abstraction and clarity 281 if (senv._print_lower_ast || fn.getFlag(FunctionNode.IS_PRINT_LOWER_AST)) { 282 err.println("Lower AST for: " + quote(newFunctionNode.getName())); 283 err.println(new ASTWriter(newFunctionNode)); 284 } 285 286 if (senv._print_lower_parse || fn.getFlag(FunctionNode.IS_PRINT_LOWER_PARSE)) { 287 err.println("Lower AST for: " + quote(newFunctionNode.getName())); 288 err.println(new PrintVisitor(newFunctionNode)); 289 } 290 291 return newFunctionNode; 292 } 293 294 @Override 295 public String toString() { 296 return "'Local Variable Type Calculation'"; 297 } 298 }; 299 300 static final CompilationPhase LOCAL_VARIABLE_TYPE_CALCULATION_PHASE = new LocalVariableTypeCalculationPhase(); 301 302 private static final class ReuseCompileUnitsPhase extends CompilationPhase { 303 @Override 304 FunctionNode transform(final Compiler compiler, final CompilationPhases phases, final FunctionNode fn) { 305 assert phases.isRestOfCompilation() : "reuse compile units currently only used for Rest-Of methods"; 306 | 261 } 262 return fn; 263 } 264 265 @Override 266 public String toString() { 267 return "'Optimistic Type Assignment'"; 268 } 269 } 270 271 static final CompilationPhase OPTIMISTIC_TYPE_ASSIGNMENT_PHASE = new OptimisticTypeAssignmentPhase(); 272 273 private static final class LocalVariableTypeCalculationPhase extends CompilationPhase { 274 @Override 275 FunctionNode transform(final Compiler compiler, final CompilationPhases phases, final FunctionNode fn) { 276 final FunctionNode newFunctionNode = transformFunction(fn, new LocalVariableTypesCalculator(compiler)); 277 final ScriptEnvironment senv = compiler.getScriptEnvironment(); 278 final PrintWriter err = senv.getErr(); 279 280 //TODO separate phase for the debug printouts for abstraction and clarity 281 if (senv._print_lower_ast || fn.getDebugFlag(FunctionNode.DEBUG_PRINT_LOWER_AST)) { 282 err.println("Lower AST for: " + quote(newFunctionNode.getName())); 283 err.println(new ASTWriter(newFunctionNode)); 284 } 285 286 if (senv._print_lower_parse || fn.getDebugFlag(FunctionNode.DEBUG_PRINT_LOWER_PARSE)) { 287 err.println("Lower AST for: " + quote(newFunctionNode.getName())); 288 err.println(new PrintVisitor(newFunctionNode)); 289 } 290 291 return newFunctionNode; 292 } 293 294 @Override 295 public String toString() { 296 return "'Local Variable Type Calculation'"; 297 } 298 }; 299 300 static final CompilationPhase LOCAL_VARIABLE_TYPE_CALCULATION_PHASE = new LocalVariableTypeCalculationPhase(); 301 302 private static final class ReuseCompileUnitsPhase extends CompilationPhase { 303 @Override 304 FunctionNode transform(final Compiler compiler, final CompilationPhases phases, final FunctionNode fn) { 305 assert phases.isRestOfCompilation() : "reuse compile units currently only used for Rest-Of methods"; 306 |