Lines 340-345
Link Here
|
340 |
public static void parse(ICompilationUnit[] compilationUnits, ASTRequestor astRequestor, int apiLevel, Map options, int flags, IProgressMonitor monitor) { |
340 |
public static void parse(ICompilationUnit[] compilationUnits, ASTRequestor astRequestor, int apiLevel, Map options, int flags, IProgressMonitor monitor) { |
341 |
try { |
341 |
try { |
342 |
CompilerOptions compilerOptions = new CompilerOptions(options); |
342 |
CompilerOptions compilerOptions = new CompilerOptions(options); |
|
|
343 |
compilerOptions.ignoreMethodBodies = (flags & ICompilationUnit.IGNORE_METHOD_BODIES) != 0; |
343 |
Parser parser = new CommentRecorderParser( |
344 |
Parser parser = new CommentRecorderParser( |
344 |
new ProblemReporter( |
345 |
new ProblemReporter( |
345 |
DefaultErrorHandlingPolicies.proceedWithAllProblems(), |
346 |
DefaultErrorHandlingPolicies.proceedWithAllProblems(), |
Lines 363-370
Link Here
|
363 |
//real parse of the method.... |
364 |
//real parse of the method.... |
364 |
org.eclipse.jdt.internal.compiler.ast.TypeDeclaration[] types = compilationUnitDeclaration.types; |
365 |
org.eclipse.jdt.internal.compiler.ast.TypeDeclaration[] types = compilationUnitDeclaration.types; |
365 |
if (types != null) { |
366 |
if (types != null) { |
366 |
for (int j = 0, typeLength = types.length; j < typeLength; j++) |
367 |
for (int j = 0, typeLength = types.length; j < typeLength; j++) { |
367 |
types[j].parseMethods(parser, compilationUnitDeclaration); |
368 |
types[j].parseMethods(parser, compilationUnitDeclaration); |
|
|
369 |
} |
368 |
} |
370 |
} |
369 |
|
371 |
|
370 |
// convert AST |
372 |
// convert AST |
Lines 393-398
Link Here
|
393 |
boolean statementsRecovery = (flags & ICompilationUnit.ENABLE_STATEMENTS_RECOVERY) != 0; |
395 |
boolean statementsRecovery = (flags & ICompilationUnit.ENABLE_STATEMENTS_RECOVERY) != 0; |
394 |
compilerOptions.performMethodsFullRecovery = statementsRecovery; |
396 |
compilerOptions.performMethodsFullRecovery = statementsRecovery; |
395 |
compilerOptions.performStatementsRecovery = statementsRecovery; |
397 |
compilerOptions.performStatementsRecovery = statementsRecovery; |
|
|
398 |
compilerOptions.ignoreMethodBodies = (flags & ICompilationUnit.IGNORE_METHOD_BODIES) != 0; |
396 |
Parser parser = new CommentRecorderParser( |
399 |
Parser parser = new CommentRecorderParser( |
397 |
new ProblemReporter( |
400 |
new ProblemReporter( |
398 |
DefaultErrorHandlingPolicies.proceedWithAllProblems(), |
401 |
DefaultErrorHandlingPolicies.proceedWithAllProblems(), |
Lines 435-447
Link Here
|
435 |
} |
438 |
} |
436 |
} |
439 |
} |
437 |
} else { |
440 |
} else { |
438 |
//fill the methods bodies in order for the code to be generated |
441 |
//fill the methods bodies in order for the code to be generated |
439 |
//real parse of the method.... |
442 |
//real parse of the method.... |
440 |
org.eclipse.jdt.internal.compiler.ast.TypeDeclaration[] types = compilationUnitDeclaration.types; |
443 |
org.eclipse.jdt.internal.compiler.ast.TypeDeclaration[] types = compilationUnitDeclaration.types; |
441 |
if (types != null) { |
444 |
if (types != null) { |
442 |
for (int i = 0, length = types.length; i < length; i++) |
445 |
for (int j = 0, typeLength = types.length; j < typeLength; j++) { |
443 |
types[i].parseMethods(parser, compilationUnitDeclaration); |
446 |
types[j].parseMethods(parser, compilationUnitDeclaration); |
444 |
} |
447 |
} |
|
|
448 |
} |
445 |
} |
449 |
} |
446 |
return compilationUnitDeclaration; |
450 |
return compilationUnitDeclaration; |
447 |
} |
451 |
} |
Lines 466-480
Link Here
|
466 |
} |
470 |
} |
467 |
environment = new CancelableNameEnvironment(((JavaProject) javaProject), owner, monitor); |
471 |
environment = new CancelableNameEnvironment(((JavaProject) javaProject), owner, monitor); |
468 |
problemFactory = new CancelableProblemFactory(monitor); |
472 |
problemFactory = new CancelableProblemFactory(monitor); |
|
|
473 |
CompilerOptions compilerOptions = getCompilerOptions(options, (flags & ICompilationUnit.ENABLE_STATEMENTS_RECOVERY) != 0); |
474 |
compilerOptions.ignoreMethodBodies = (flags & ICompilationUnit.IGNORE_METHOD_BODIES) != 0; |
469 |
CompilationUnitResolver resolver = |
475 |
CompilationUnitResolver resolver = |
470 |
new CompilationUnitResolver( |
476 |
new CompilationUnitResolver( |
471 |
environment, |
477 |
environment, |
472 |
getHandlingPolicy(), |
478 |
getHandlingPolicy(), |
473 |
getCompilerOptions(options, (flags & ICompilationUnit.ENABLE_STATEMENTS_RECOVERY) != 0), |
479 |
compilerOptions, |
474 |
getRequestor(), |
480 |
getRequestor(), |
475 |
problemFactory, |
481 |
problemFactory, |
476 |
monitor); |
482 |
monitor); |
477 |
|
|
|
478 |
resolver.resolve(compilationUnits, bindingKeys, requestor, apiLevel, options, owner, flags); |
483 |
resolver.resolve(compilationUnits, bindingKeys, requestor, apiLevel, options, owner, flags); |
479 |
if (NameLookup.VERBOSE) { |
484 |
if (NameLookup.VERBOSE) { |
480 |
System.out.println(Thread.currentThread() + " TIME SPENT in NameLoopkup#seekTypesInSourcePackage: " + environment.nameLookup.timeSpentInSeekTypesInSourcePackage + "ms"); //$NON-NLS-1$ //$NON-NLS-2$ |
485 |
System.out.println(Thread.currentThread() + " TIME SPENT in NameLoopkup#seekTypesInSourcePackage: " + environment.nameLookup.timeSpentInSeekTypesInSourcePackage + "ms"); //$NON-NLS-1$ //$NON-NLS-2$ |
Lines 509-531
Link Here
|
509 |
try { |
514 |
try { |
510 |
environment = new CancelableNameEnvironment(((JavaProject)javaProject), owner, monitor); |
515 |
environment = new CancelableNameEnvironment(((JavaProject)javaProject), owner, monitor); |
511 |
problemFactory = new CancelableProblemFactory(monitor); |
516 |
problemFactory = new CancelableProblemFactory(monitor); |
|
|
517 |
CompilerOptions compilerOptions = getCompilerOptions(options, (flags & ICompilationUnit.ENABLE_STATEMENTS_RECOVERY) != 0); |
518 |
boolean ignoreMethodBodies = (flags & ICompilationUnit.IGNORE_METHOD_BODIES) != 0; |
519 |
compilerOptions.ignoreMethodBodies = ignoreMethodBodies; |
512 |
resolver = |
520 |
resolver = |
513 |
new CompilationUnitResolver( |
521 |
new CompilationUnitResolver( |
514 |
environment, |
522 |
environment, |
515 |
getHandlingPolicy(), |
523 |
getHandlingPolicy(), |
516 |
getCompilerOptions(options, (flags & ICompilationUnit.ENABLE_STATEMENTS_RECOVERY) != 0), |
524 |
compilerOptions, |
517 |
getRequestor(), |
525 |
getRequestor(), |
518 |
problemFactory, |
526 |
problemFactory, |
519 |
monitor); |
527 |
monitor); |
520 |
|
528 |
boolean analyzeCode = true; |
|
|
529 |
boolean generateCode = true; |
530 |
if (ignoreMethodBodies) { |
531 |
analyzeCode = false; |
532 |
generateCode = false; |
533 |
} |
521 |
unit = |
534 |
unit = |
522 |
resolver.resolve( |
535 |
resolver.resolve( |
523 |
null, // no existing compilation unit declaration |
536 |
null, // no existing compilation unit declaration |
524 |
sourceUnit, |
537 |
sourceUnit, |
525 |
nodeSearcher, |
538 |
nodeSearcher, |
526 |
true, // method verification |
539 |
true, // method verification |
527 |
true, // analyze code |
540 |
analyzeCode, // analyze code |
528 |
true); // generate code |
541 |
generateCode); // generate code |
529 |
if (resolver.hasCompilationAborted) { |
542 |
if (resolver.hasCompilationAborted) { |
530 |
// the bindings could not be resolved due to missing types in name environment |
543 |
// the bindings could not be resolved due to missing types in name environment |
531 |
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=86541 |
544 |
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=86541 |