Lines 44-52
Link Here
|
44 |
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; |
44 |
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; |
45 |
import org.eclipse.jdt.internal.compiler.env.IConstants; |
45 |
import org.eclipse.jdt.internal.compiler.env.IConstants; |
46 |
import org.eclipse.jdt.internal.compiler.env.IGenericType; |
46 |
import org.eclipse.jdt.internal.compiler.env.IGenericType; |
|
|
47 |
import org.eclipse.jdt.internal.compiler.impl.Constant; |
47 |
import org.eclipse.jdt.internal.compiler.lookup.BlockScope; |
48 |
import org.eclipse.jdt.internal.compiler.lookup.BlockScope; |
48 |
import org.eclipse.jdt.internal.compiler.lookup.CompilerModifiers; |
49 |
import org.eclipse.jdt.internal.compiler.lookup.CompilerModifiers; |
49 |
import org.eclipse.jdt.internal.compiler.lookup.TypeConstants; |
50 |
import org.eclipse.jdt.internal.compiler.lookup.TypeConstants; |
|
|
51 |
import org.eclipse.jdt.internal.compiler.lookup.TypeIds; |
50 |
import org.eclipse.jdt.internal.compiler.parser.Scanner; |
52 |
import org.eclipse.jdt.internal.compiler.parser.Scanner; |
51 |
import org.eclipse.jdt.internal.compiler.parser.TerminalTokens; |
53 |
import org.eclipse.jdt.internal.compiler.parser.TerminalTokens; |
52 |
|
54 |
|
Lines 886-891
Link Here
|
886 |
if (this.resolveBindings) { |
888 |
if (this.resolveBindings) { |
887 |
this.recordNodes(infixExpression, expression); |
889 |
this.recordNodes(infixExpression, expression); |
888 |
} |
890 |
} |
|
|
891 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=88548 |
892 |
final Constant constant = expression.constant; |
893 |
if (constant != null && constant != Constant.NotAConstant) { |
894 |
infixExpression.constant = convert(constant); |
895 |
} |
889 |
|
896 |
|
890 |
int expressionOperatorID = (expression.bits & org.eclipse.jdt.internal.compiler.ast.ASTNode.OperatorMASK) >> org.eclipse.jdt.internal.compiler.ast.ASTNode.OperatorSHIFT; |
897 |
int expressionOperatorID = (expression.bits & org.eclipse.jdt.internal.compiler.ast.ASTNode.OperatorMASK) >> org.eclipse.jdt.internal.compiler.ast.ASTNode.OperatorSHIFT; |
891 |
switch (expressionOperatorID) { |
898 |
switch (expressionOperatorID) { |
Lines 1088-1093
Link Here
|
1088 |
if (this.resolveBindings) { |
1095 |
if (this.resolveBindings) { |
1089 |
recordNodes(castExpression, expression); |
1096 |
recordNodes(castExpression, expression); |
1090 |
} |
1097 |
} |
|
|
1098 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=88548 |
1099 |
final Constant constant = expression.constant; |
1100 |
if (constant != null && constant != Constant.NotAConstant) { |
1101 |
castExpression.constant = convert(constant); |
1102 |
} |
1091 |
return castExpression; |
1103 |
return castExpression; |
1092 |
} |
1104 |
} |
1093 |
|
1105 |
|
Lines 1103-1108
Link Here
|
1103 |
literal.setEscapedValue(new String(tokens)); |
1115 |
literal.setEscapedValue(new String(tokens)); |
1104 |
literal.setSourceRange(sourceStart, length); |
1116 |
literal.setSourceRange(sourceStart, length); |
1105 |
removeLeadingAndTrailingCommentsFromLiteral(literal); |
1117 |
removeLeadingAndTrailingCommentsFromLiteral(literal); |
|
|
1118 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=88548 |
1119 |
final Constant constant = expression.constant; |
1120 |
if (constant != null && constant != Constant.NotAConstant) { |
1121 |
literal.constant = convert(constant); |
1122 |
} |
1106 |
return literal; |
1123 |
return literal; |
1107 |
} |
1124 |
} |
1108 |
public Expression convert(org.eclipse.jdt.internal.compiler.ast.ClassLiteralAccess expression) { |
1125 |
public Expression convert(org.eclipse.jdt.internal.compiler.ast.ClassLiteralAccess expression) { |
Lines 1234-1239
Link Here
|
1234 |
conditionalExpression.setExpression(convert(expression.condition)); |
1251 |
conditionalExpression.setExpression(convert(expression.condition)); |
1235 |
conditionalExpression.setThenExpression(convert(expression.valueIfTrue)); |
1252 |
conditionalExpression.setThenExpression(convert(expression.valueIfTrue)); |
1236 |
conditionalExpression.setElseExpression(convert(expression.valueIfFalse)); |
1253 |
conditionalExpression.setElseExpression(convert(expression.valueIfFalse)); |
|
|
1254 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=88548 |
1255 |
final Constant constant = expression.constant; |
1256 |
if (constant != null && constant != Constant.NotAConstant) { |
1257 |
conditionalExpression.constant = convert(constant); |
1258 |
} |
1237 |
return conditionalExpression; |
1259 |
return conditionalExpression; |
1238 |
} |
1260 |
} |
1239 |
|
1261 |
|
Lines 1248-1253
Link Here
|
1248 |
retrieveSemiColonPosition(continueStatement); |
1270 |
retrieveSemiColonPosition(continueStatement); |
1249 |
return continueStatement; |
1271 |
return continueStatement; |
1250 |
} |
1272 |
} |
|
|
1273 |
|
1274 |
private Object convert(Constant constant) { |
1275 |
switch (constant.typeID()) { |
1276 |
case TypeIds.T_int : return new Integer(constant.intValue()); |
1277 |
case TypeIds.T_byte : return new Byte(constant.byteValue()); |
1278 |
case TypeIds.T_short : return new Short(constant.shortValue()); |
1279 |
case TypeIds.T_char : return new Character(constant.charValue()); |
1280 |
case TypeIds.T_float : return new Float(constant.floatValue()); |
1281 |
case TypeIds.T_double : return new Double(constant.doubleValue()); |
1282 |
case TypeIds.T_boolean : return constant.booleanValue() ? Boolean.TRUE : Boolean.FALSE; |
1283 |
case TypeIds.T_long : return new Long(constant.longValue()); |
1284 |
case TypeIds.T_JavaLangString : return constant.stringValue(); |
1285 |
} |
1286 |
return null; |
1287 |
} |
1251 |
|
1288 |
|
1252 |
public DoStatement convert(org.eclipse.jdt.internal.compiler.ast.DoStatement statement) { |
1289 |
public DoStatement convert(org.eclipse.jdt.internal.compiler.ast.DoStatement statement) { |
1253 |
DoStatement doStatement = this.ast.newDoStatement(); |
1290 |
DoStatement doStatement = this.ast.newDoStatement(); |
Lines 1269-1274
Link Here
|
1269 |
} |
1306 |
} |
1270 |
literal.setSourceRange(sourceStart, length); |
1307 |
literal.setSourceRange(sourceStart, length); |
1271 |
removeLeadingAndTrailingCommentsFromLiteral(literal); |
1308 |
removeLeadingAndTrailingCommentsFromLiteral(literal); |
|
|
1309 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=88548 |
1310 |
final Constant constant = expression.constant; |
1311 |
if (constant != null && constant != Constant.NotAConstant) { |
1312 |
literal.constant = convert(constant); |
1313 |
} |
1272 |
return literal; |
1314 |
return literal; |
1273 |
} |
1315 |
} |
1274 |
|
1316 |
|
Lines 1330-1335
Link Here
|
1330 |
if (this.resolveBindings) { |
1372 |
if (this.resolveBindings) { |
1331 |
recordNodes(infixExpression, expression); |
1373 |
recordNodes(infixExpression, expression); |
1332 |
} |
1374 |
} |
|
|
1375 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=88548 |
1376 |
final Constant constant = expression.constant; |
1377 |
if (constant != null && constant != Constant.NotAConstant) { |
1378 |
infixExpression.constant = convert(expression.constant); |
1379 |
} |
1333 |
Expression leftExpression = convert(expression.left); |
1380 |
Expression leftExpression = convert(expression.left); |
1334 |
infixExpression.setLeftOperand(leftExpression); |
1381 |
infixExpression.setLeftOperand(leftExpression); |
1335 |
infixExpression.setRightOperand(convert(expression.right)); |
1382 |
infixExpression.setRightOperand(convert(expression.right)); |
Lines 1567-1572
Link Here
|
1567 |
recordNodes(simpleName, reference); |
1614 |
recordNodes(simpleName, reference); |
1568 |
} |
1615 |
} |
1569 |
superFieldAccess.setSourceRange(reference.receiver.sourceStart, reference.sourceEnd - reference.receiver.sourceStart + 1); |
1616 |
superFieldAccess.setSourceRange(reference.receiver.sourceStart, reference.sourceEnd - reference.receiver.sourceStart + 1); |
|
|
1617 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=88548 |
1618 |
final Constant constant = reference.constant; |
1619 |
if (constant != null && constant != Constant.NotAConstant) { |
1620 |
superFieldAccess.constant = convert(constant); |
1621 |
} |
1570 |
return superFieldAccess; |
1622 |
return superFieldAccess; |
1571 |
} else { |
1623 |
} else { |
1572 |
FieldAccess fieldAccess = this.ast.newFieldAccess(); |
1624 |
FieldAccess fieldAccess = this.ast.newFieldAccess(); |
Lines 1584-1589
Link Here
|
1584 |
recordNodes(simpleName, reference); |
1636 |
recordNodes(simpleName, reference); |
1585 |
} |
1637 |
} |
1586 |
fieldAccess.setSourceRange(receiver.getStartPosition(), reference.sourceEnd - receiver.getStartPosition() + 1); |
1638 |
fieldAccess.setSourceRange(receiver.getStartPosition(), reference.sourceEnd - receiver.getStartPosition() + 1); |
|
|
1639 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=88548 |
1640 |
final Constant constant = reference.constant; |
1641 |
if (constant != null && constant != Constant.NotAConstant) { |
1642 |
fieldAccess.constant = convert(constant); |
1643 |
} |
1587 |
return fieldAccess; |
1644 |
return fieldAccess; |
1588 |
} |
1645 |
} |
1589 |
} |
1646 |
} |
Lines 1599-1604
Link Here
|
1599 |
} |
1656 |
} |
1600 |
literal.setSourceRange(sourceStart, length); |
1657 |
literal.setSourceRange(sourceStart, length); |
1601 |
removeLeadingAndTrailingCommentsFromLiteral(literal); |
1658 |
removeLeadingAndTrailingCommentsFromLiteral(literal); |
|
|
1659 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=88548 |
1660 |
final Constant constant = expression.constant; |
1661 |
if (constant != null && constant != Constant.NotAConstant) { |
1662 |
literal.constant = convert(constant); |
1663 |
} |
1602 |
return literal; |
1664 |
return literal; |
1603 |
} |
1665 |
} |
1604 |
|
1666 |
|
Lines 1699-1704
Link Here
|
1699 |
} |
1761 |
} |
1700 |
literal.setSourceRange(sourceStart, length); |
1762 |
literal.setSourceRange(sourceStart, length); |
1701 |
removeLeadingAndTrailingCommentsFromLiteral(literal); |
1763 |
removeLeadingAndTrailingCommentsFromLiteral(literal); |
|
|
1764 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=88548 |
1765 |
final Constant constant = expression.constant; |
1766 |
if (constant != null && constant != Constant.NotAConstant) { |
1767 |
literal.constant = convert(constant); |
1768 |
} |
1702 |
return literal; |
1769 |
return literal; |
1703 |
} |
1770 |
} |
1704 |
|
1771 |
|
Lines 1713-1718
Link Here
|
1713 |
} |
1780 |
} |
1714 |
literal.setSourceRange(sourceStart, length); |
1781 |
literal.setSourceRange(sourceStart, length); |
1715 |
removeLeadingAndTrailingCommentsFromLiteral(literal); |
1782 |
removeLeadingAndTrailingCommentsFromLiteral(literal); |
|
|
1783 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=88548 |
1784 |
final Constant constant = expression.constant; |
1785 |
if (constant != null && constant != Constant.NotAConstant) { |
1786 |
literal.constant = convert(constant); |
1787 |
} |
1716 |
return literal; |
1788 |
return literal; |
1717 |
} |
1789 |
} |
1718 |
|
1790 |
|
Lines 1761-1766
Link Here
|
1761 |
} |
1833 |
} |
1762 |
literal.setSourceRange(sourceStart, length); |
1834 |
literal.setSourceRange(sourceStart, length); |
1763 |
removeLeadingAndTrailingCommentsFromLiteral(literal); |
1835 |
removeLeadingAndTrailingCommentsFromLiteral(literal); |
|
|
1836 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=88548 |
1837 |
final Constant constant = expression.constant; |
1838 |
if (constant != null && constant != Constant.NotAConstant) { |
1839 |
literal.constant = convert(constant); |
1840 |
} |
1764 |
return literal; |
1841 |
return literal; |
1765 |
} |
1842 |
} |
1766 |
|
1843 |
|
Lines 1775-1780
Link Here
|
1775 |
} |
1852 |
} |
1776 |
literal.setSourceRange(sourceStart, length); |
1853 |
literal.setSourceRange(sourceStart, length); |
1777 |
removeLeadingAndTrailingCommentsFromLiteral(literal); |
1854 |
removeLeadingAndTrailingCommentsFromLiteral(literal); |
|
|
1855 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=88548 |
1856 |
final Constant constant = expression.constant; |
1857 |
if (constant != null && constant != Constant.NotAConstant) { |
1858 |
literal.constant = convert(constant); |
1859 |
} |
1778 |
return literal; |
1860 |
return literal; |
1779 |
} |
1861 |
} |
1780 |
|
1862 |
|
Lines 1948-1953
Link Here
|
1948 |
this.recordNodes(infixExpression, expression); |
2030 |
this.recordNodes(infixExpression, expression); |
1949 |
} |
2031 |
} |
1950 |
infixExpression.setSourceRange(expression.sourceStart, expression.sourceEnd - expression.sourceStart + 1); |
2032 |
infixExpression.setSourceRange(expression.sourceStart, expression.sourceEnd - expression.sourceStart + 1); |
|
|
2033 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=88548 |
2034 |
final Constant constant = expression.constant; |
2035 |
if (constant != null && constant != Constant.NotAConstant) { |
2036 |
infixExpression.constant = convert(constant); |
2037 |
} |
1951 |
return infixExpression; |
2038 |
return infixExpression; |
1952 |
} |
2039 |
} |
1953 |
|
2040 |
|
Lines 2088-2094
Link Here
|
2088 |
} |
2175 |
} |
2089 |
|
2176 |
|
2090 |
public Name convert(org.eclipse.jdt.internal.compiler.ast.QualifiedNameReference nameReference) { |
2177 |
public Name convert(org.eclipse.jdt.internal.compiler.ast.QualifiedNameReference nameReference) { |
2091 |
return setQualifiedNameNameAndSourceRanges(nameReference.tokens, nameReference.sourcePositions, nameReference); |
2178 |
Name name = setQualifiedNameNameAndSourceRanges(nameReference.tokens, nameReference.sourcePositions, nameReference); |
|
|
2179 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=88548 |
2180 |
final Constant constant = nameReference.constant; |
2181 |
if (constant != null && constant != Constant.NotAConstant) { |
2182 |
name.constant = convert(constant); |
2183 |
} |
2184 |
return name; |
2092 |
} |
2185 |
} |
2093 |
|
2186 |
|
2094 |
public Name convert(org.eclipse.jdt.internal.compiler.ast.QualifiedSuperReference reference) { |
2187 |
public Name convert(org.eclipse.jdt.internal.compiler.ast.QualifiedSuperReference reference) { |
Lines 2151-2156
Link Here
|
2151 |
recordNodes(name, nameReference); |
2244 |
recordNodes(name, nameReference); |
2152 |
} |
2245 |
} |
2153 |
name.setSourceRange(nameReference.sourceStart, nameReference.sourceEnd - nameReference.sourceStart + 1); |
2246 |
name.setSourceRange(nameReference.sourceStart, nameReference.sourceEnd - nameReference.sourceStart + 1); |
|
|
2247 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=88548 |
2248 |
final Constant constant = nameReference.constant; |
2249 |
if (constant != null && constant != Constant.NotAConstant) { |
2250 |
name.constant = convert(constant); |
2251 |
} |
2154 |
return name; |
2252 |
return name; |
2155 |
} |
2253 |
} |
2156 |
|
2254 |
|
Lines 2284-2289
Link Here
|
2284 |
} |
2382 |
} |
2285 |
literal.setEscapedValue(new String(tokens)); |
2383 |
literal.setEscapedValue(new String(tokens)); |
2286 |
literal.setSourceRange(expression.sourceStart, expression.sourceEnd - expression.sourceStart + 1); |
2384 |
literal.setSourceRange(expression.sourceStart, expression.sourceEnd - expression.sourceStart + 1); |
|
|
2385 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=88548 |
2386 |
final Constant constant = expression.constant; |
2387 |
if (constant != null && constant != Constant.NotAConstant) { |
2388 |
literal.constant = convert(constant); |
2389 |
} |
2287 |
return literal; |
2390 |
return literal; |
2288 |
} |
2391 |
} |
2289 |
|
2392 |
|
Lines 2518-2523
Link Here
|
2518 |
break; |
2621 |
break; |
2519 |
case org.eclipse.jdt.internal.compiler.ast.OperatorIds.TWIDDLE : |
2622 |
case org.eclipse.jdt.internal.compiler.ast.OperatorIds.TWIDDLE : |
2520 |
prefixExpression.setOperator(PrefixExpression.Operator.COMPLEMENT); |
2623 |
prefixExpression.setOperator(PrefixExpression.Operator.COMPLEMENT); |
|
|
2624 |
} |
2625 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=88548 |
2626 |
final Constant constant = expression.constant; |
2627 |
if (constant != null && constant != Constant.NotAConstant) { |
2628 |
prefixExpression.constant = convert(constant); |
2521 |
} |
2629 |
} |
2522 |
return prefixExpression; |
2630 |
return prefixExpression; |
2523 |
} |
2631 |
} |