Lines 487-501
Link Here
|
487 |
|
487 |
|
488 |
org.eclipse.jdt.internal.compiler.ast.Statement[] statements = methodDeclaration.statements; |
488 |
org.eclipse.jdt.internal.compiler.ast.Statement[] statements = methodDeclaration.statements; |
489 |
|
489 |
|
490 |
start = retrieveStartBlockPosition(methodDeclaration.sourceStart, declarationSourceEnd); |
490 |
startPosition = methodDeclaration.sourceEnd + 1; |
491 |
end = retrieveEndBlockPosition(methodDeclaration.sourceStart, methodDeclaration.declarationSourceEnd); |
491 |
if (parameters != null) { |
|
|
492 |
if (thrownExceptions != null) { |
493 |
List thrownExceptionsList = methodDecl.thrownExceptions(); |
494 |
ASTNode exception = (ASTNode) thrownExceptionsList.get(thrownExceptionsList.size() - 1); |
495 |
startPosition = exception.getStartPosition() + exception.getLength(); |
496 |
} else { |
497 |
List parameterList = methodDecl.parameters(); |
498 |
ASTNode lastParameter = (ASTNode) parameterList.get(parameterList.size() - 1); |
499 |
startPosition = lastParameter.getStartPosition() + lastParameter.getLength(); |
500 |
} |
501 |
} else if (thrownExceptions != null) { |
502 |
List thrownExceptionsList = methodDecl.thrownExceptions(); |
503 |
ASTNode exception = (ASTNode) thrownExceptionsList.get(thrownExceptionsList.size() - 1); |
504 |
startPosition = exception.getStartPosition() + exception.getLength(); |
505 |
} |
506 |
start = retrieveStartBlockPosition(startPosition, declarationSourceEnd); |
492 |
Block block = null; |
507 |
Block block = null; |
493 |
if (start != -1 && end != -1) { |
508 |
if (start != -1) { |
494 |
/* |
509 |
/* |
495 |
* start or end can be equal to -1 if we have an interface's method. |
510 |
* start or end can be equal to -1 if we have an interface's method. |
496 |
*/ |
511 |
*/ |
497 |
block = new Block(this.ast); |
512 |
block = new Block(this.ast); |
498 |
block.setSourceRange(start, end - start + 1); |
513 |
block.setSourceRange(start, closingPosition - start + 1); |
499 |
methodDecl.setBody(block); |
514 |
methodDecl.setBody(block); |
500 |
} |
515 |
} |
501 |
if (block != null && (statements != null || explicitConstructorCall != null)) { |
516 |
if (block != null && (statements != null || explicitConstructorCall != null)) { |
Lines 520-526
Link Here
|
520 |
} else { |
535 |
} else { |
521 |
// syntax error in this method declaration |
536 |
// syntax error in this method declaration |
522 |
if (!methodDeclaration.isNative() && !methodDeclaration.isAbstract()) { |
537 |
if (!methodDeclaration.isNative() && !methodDeclaration.isAbstract()) { |
523 |
start = retrieveStartBlockPosition(methodDeclaration.sourceStart, declarationSourceEnd); |
538 |
int startPosition = methodDeclaration.sourceEnd + 1; |
|
|
539 |
if (parameters != null) { |
540 |
if (thrownExceptions != null) { |
541 |
List thrownExceptionsList = methodDecl.thrownExceptions(); |
542 |
ASTNode exception = (ASTNode) thrownExceptionsList.get(thrownExceptionsList.size() - 1); |
543 |
startPosition = exception.getStartPosition() + exception.getLength(); |
544 |
} else { |
545 |
List parameterList = methodDecl.parameters(); |
546 |
ASTNode lastParameter = (ASTNode) parameterList.get(parameterList.size() - 1); |
547 |
startPosition = lastParameter.getStartPosition() + lastParameter.getLength(); |
548 |
} |
549 |
} else if (thrownExceptions != null) { |
550 |
List thrownExceptionsList = methodDecl.thrownExceptions(); |
551 |
ASTNode exception = (ASTNode) thrownExceptionsList.get(thrownExceptionsList.size() - 1); |
552 |
startPosition = exception.getStartPosition() + exception.getLength(); |
553 |
} |
554 |
start = retrieveStartBlockPosition(startPosition, declarationSourceEnd); |
524 |
end = methodDeclaration.bodyEnd; |
555 |
end = methodDeclaration.bodyEnd; |
525 |
// try to get the best end position |
556 |
// try to get the best end position |
526 |
CategorizedProblem[] problems = methodDeclaration.compilationResult().problems; |
557 |
CategorizedProblem[] problems = methodDeclaration.compilationResult().problems; |
Lines 533-539
Link Here
|
533 |
} |
564 |
} |
534 |
} |
565 |
} |
535 |
} |
566 |
} |
536 |
int startPosition = methodDecl.getStartPosition(); |
567 |
startPosition = methodDecl.getStartPosition(); |
537 |
methodDecl.setSourceRange(startPosition, end - startPosition + 1); |
568 |
methodDecl.setSourceRange(startPosition, end - startPosition + 1); |
538 |
if (start != -1 && end != -1) { |
569 |
if (start != -1 && end != -1) { |
539 |
/* |
570 |
/* |
Lines 543-549
Link Here
|
543 |
block.setSourceRange(start, end - start + 1); |
574 |
block.setSourceRange(start, end - start + 1); |
544 |
methodDecl.setBody(block); |
575 |
methodDecl.setBody(block); |
545 |
} |
576 |
} |
546 |
} |
577 |
} |
547 |
} |
578 |
} |
548 |
|
579 |
|
549 |
org.eclipse.jdt.internal.compiler.ast.TypeParameter[] typeParameters = methodDeclaration.typeParameters(); |
580 |
org.eclipse.jdt.internal.compiler.ast.TypeParameter[] typeParameters = methodDeclaration.typeParameters(); |
Lines 4296-4305
Link Here
|
4296 |
this.scanner.resetTo(start, end); |
4327 |
this.scanner.resetTo(start, end); |
4297 |
try { |
4328 |
try { |
4298 |
int token; |
4329 |
int token; |
4299 |
while ((token = this.scanner.getNextToken()) != TerminalTokens.TokenNameEOF) { |
4330 |
loop: while ((token = this.scanner.getNextToken()) != TerminalTokens.TokenNameEOF) { |
4300 |
switch(token) { |
4331 |
switch(token) { |
|
|
4332 |
case TerminalTokens.TokenNameWHITESPACE://110 |
4333 |
case TerminalTokens.TokenNameRPAREN://110 |
4334 |
case TerminalTokens.TokenNameLPAREN://110 |
4335 |
continue loop; |
4301 |
case TerminalTokens.TokenNameLBRACE://110 |
4336 |
case TerminalTokens.TokenNameLBRACE://110 |
4302 |
return this.scanner.startPosition; |
4337 |
return this.scanner.startPosition; |
|
|
4338 |
default: |
4339 |
return this.scanner.startPosition; |
4303 |
} |
4340 |
} |
4304 |
} |
4341 |
} |
4305 |
} catch(InvalidInputException e) { |
4342 |
} catch(InvalidInputException e) { |