Lines 72-77
Link Here
|
72 |
* @since 3.0 |
72 |
* @since 3.0 |
73 |
*/ |
73 |
*/ |
74 |
public class ASTParser { |
74 |
public class ASTParser { |
|
|
75 |
private static final int[] EMPTY_LINE_ENDS = new int[0]; |
75 |
|
76 |
|
76 |
/** |
77 |
/** |
77 |
* Kind constant used to request that the source be parsed |
78 |
* Kind constant used to request that the source be parsed |
Lines 920-926
Link Here
|
920 |
if (comments != null) { |
921 |
if (comments != null) { |
921 |
converter.buildCommentsTable(compilationUnit, comments); |
922 |
converter.buildCommentsTable(compilationUnit, comments); |
922 |
} |
923 |
} |
923 |
compilationUnit.setLineEndTable(recordedParsingInformation.lineEnds); |
924 |
int[] lineEnds = recordedParsingInformation.lineEnds; |
|
|
925 |
if (lineEnds == null) { |
926 |
compilationUnit.setLineEndTable(EMPTY_LINE_ENDS); |
927 |
} else { |
928 |
compilationUnit.setLineEndTable(lineEnds); |
929 |
} |
924 |
if (constructorDeclaration != null) { |
930 |
if (constructorDeclaration != null) { |
925 |
Block block = ast.newBlock(); |
931 |
Block block = ast.newBlock(); |
926 |
Statement[] statements = constructorDeclaration.statements; |
932 |
Statement[] statements = constructorDeclaration.statements; |
Lines 954-960
Link Here
|
954 |
if (comments != null) { |
960 |
if (comments != null) { |
955 |
converter.buildCommentsTable(compilationUnit, comments); |
961 |
converter.buildCommentsTable(compilationUnit, comments); |
956 |
} |
962 |
} |
957 |
compilationUnit.setLineEndTable(recordedParsingInformation.lineEnds); |
963 |
lineEnds = recordedParsingInformation.lineEnds; |
|
|
964 |
if (lineEnds == null) { |
965 |
compilationUnit.setLineEndTable(EMPTY_LINE_ENDS); |
966 |
} else { |
967 |
compilationUnit.setLineEndTable(lineEnds); |
968 |
} |
958 |
if (expression != null) { |
969 |
if (expression != null) { |
959 |
Expression expression2 = converter.convert(expression); |
970 |
Expression expression2 = converter.convert(expression); |
960 |
rootNodeToCompilationUnit(expression2.getAST(), compilationUnit, expression2, codeSnippetParsingUtil.recordedParsingInformation); |
971 |
rootNodeToCompilationUnit(expression2.getAST(), compilationUnit, expression2, codeSnippetParsingUtil.recordedParsingInformation); |
Lines 977-983
Link Here
|
977 |
if (comments != null) { |
988 |
if (comments != null) { |
978 |
converter.buildCommentsTable(compilationUnit, comments); |
989 |
converter.buildCommentsTable(compilationUnit, comments); |
979 |
} |
990 |
} |
980 |
compilationUnit.setLineEndTable(recordedParsingInformation.lineEnds); |
991 |
lineEnds = recordedParsingInformation.lineEnds; |
|
|
992 |
if (lineEnds == null) { |
993 |
compilationUnit.setLineEndTable(EMPTY_LINE_ENDS); |
994 |
} else { |
995 |
compilationUnit.setLineEndTable(lineEnds); |
996 |
} |
981 |
if (nodes != null) { |
997 |
if (nodes != null) { |
982 |
TypeDeclaration typeDeclaration = converter.convert(nodes); |
998 |
TypeDeclaration typeDeclaration = converter.convert(nodes); |
983 |
rootNodeToCompilationUnit(typeDeclaration.getAST(), compilationUnit, typeDeclaration, codeSnippetParsingUtil.recordedParsingInformation); |
999 |
rootNodeToCompilationUnit(typeDeclaration.getAST(), compilationUnit, typeDeclaration, codeSnippetParsingUtil.recordedParsingInformation); |