Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 19078 Details for
Bug 88548
Need to get constant value on expression
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Apply on org.eclipse.jdt.core.dom package in HEAD
patch_88548.txt (text/plain), 29.79 KB, created by
Olivier Thomann
on 2005-03-22 10:12:09 EST
(
hide
)
Description:
Apply on org.eclipse.jdt.core.dom package in HEAD
Filename:
MIME Type:
Creator:
Olivier Thomann
Created:
2005-03-22 10:12:09 EST
Size:
29.79 KB
patch
obsolete
>Index: ASTConverter.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTConverter.java,v >retrieving revision 1.201 >diff -u -r1.201 ASTConverter.java >--- ASTConverter.java 17 Mar 2005 05:16:24 -0000 1.201 >+++ ASTConverter.java 22 Mar 2005 15:09:33 -0000 >@@ -44,9 +44,11 @@ > import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; > import org.eclipse.jdt.internal.compiler.env.IConstants; > import org.eclipse.jdt.internal.compiler.env.IGenericType; >+import org.eclipse.jdt.internal.compiler.impl.Constant; > import org.eclipse.jdt.internal.compiler.lookup.BlockScope; > import org.eclipse.jdt.internal.compiler.lookup.CompilerModifiers; > import org.eclipse.jdt.internal.compiler.lookup.TypeConstants; >+import org.eclipse.jdt.internal.compiler.lookup.TypeIds; > import org.eclipse.jdt.internal.compiler.parser.Scanner; > import org.eclipse.jdt.internal.compiler.parser.TerminalTokens; > >@@ -886,6 +888,11 @@ > if (this.resolveBindings) { > this.recordNodes(infixExpression, expression); > } >+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=88548 >+ final Constant constant = expression.constant; >+ if (constant != null && constant != Constant.NotAConstant) { >+ infixExpression.constant = convert(constant); >+ } > > int expressionOperatorID = (expression.bits & org.eclipse.jdt.internal.compiler.ast.ASTNode.OperatorMASK) >> org.eclipse.jdt.internal.compiler.ast.ASTNode.OperatorSHIFT; > switch (expressionOperatorID) { >@@ -1088,6 +1095,11 @@ > if (this.resolveBindings) { > recordNodes(castExpression, expression); > } >+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=88548 >+ final Constant constant = expression.constant; >+ if (constant != null && constant != Constant.NotAConstant) { >+ castExpression.constant = convert(constant); >+ } > return castExpression; > } > >@@ -1103,6 +1115,11 @@ > literal.setEscapedValue(new String(tokens)); > literal.setSourceRange(sourceStart, length); > removeLeadingAndTrailingCommentsFromLiteral(literal); >+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=88548 >+ final Constant constant = expression.constant; >+ if (constant != null && constant != Constant.NotAConstant) { >+ literal.constant = convert(constant); >+ } > return literal; > } > public Expression convert(org.eclipse.jdt.internal.compiler.ast.ClassLiteralAccess expression) { >@@ -1234,6 +1251,11 @@ > conditionalExpression.setExpression(convert(expression.condition)); > conditionalExpression.setThenExpression(convert(expression.valueIfTrue)); > conditionalExpression.setElseExpression(convert(expression.valueIfFalse)); >+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=88548 >+ final Constant constant = expression.constant; >+ if (constant != null && constant != Constant.NotAConstant) { >+ conditionalExpression.constant = convert(constant); >+ } > return conditionalExpression; > } > >@@ -1248,6 +1270,21 @@ > retrieveSemiColonPosition(continueStatement); > return continueStatement; > } >+ >+ private Object convert(Constant constant) { >+ switch (constant.typeID()) { >+ case TypeIds.T_int : return new Integer(constant.intValue()); >+ case TypeIds.T_byte : return new Byte(constant.byteValue()); >+ case TypeIds.T_short : return new Short(constant.shortValue()); >+ case TypeIds.T_char : return new Character(constant.charValue()); >+ case TypeIds.T_float : return new Float(constant.floatValue()); >+ case TypeIds.T_double : return new Double(constant.doubleValue()); >+ case TypeIds.T_boolean : return constant.booleanValue() ? Boolean.TRUE : Boolean.FALSE; >+ case TypeIds.T_long : return new Long(constant.longValue()); >+ case TypeIds.T_JavaLangString : return constant.stringValue(); >+ } >+ return null; >+ } > > public DoStatement convert(org.eclipse.jdt.internal.compiler.ast.DoStatement statement) { > DoStatement doStatement = this.ast.newDoStatement(); >@@ -1269,6 +1306,11 @@ > } > literal.setSourceRange(sourceStart, length); > removeLeadingAndTrailingCommentsFromLiteral(literal); >+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=88548 >+ final Constant constant = expression.constant; >+ if (constant != null && constant != Constant.NotAConstant) { >+ literal.constant = convert(constant); >+ } > return literal; > } > >@@ -1330,6 +1372,11 @@ > if (this.resolveBindings) { > recordNodes(infixExpression, expression); > } >+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=88548 >+ final Constant constant = expression.constant; >+ if (constant != null && constant != Constant.NotAConstant) { >+ infixExpression.constant = convert(expression.constant); >+ } > Expression leftExpression = convert(expression.left); > infixExpression.setLeftOperand(leftExpression); > infixExpression.setRightOperand(convert(expression.right)); >@@ -1567,6 +1614,11 @@ > recordNodes(simpleName, reference); > } > superFieldAccess.setSourceRange(reference.receiver.sourceStart, reference.sourceEnd - reference.receiver.sourceStart + 1); >+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=88548 >+ final Constant constant = reference.constant; >+ if (constant != null && constant != Constant.NotAConstant) { >+ superFieldAccess.constant = convert(constant); >+ } > return superFieldAccess; > } else { > FieldAccess fieldAccess = this.ast.newFieldAccess(); >@@ -1584,6 +1636,11 @@ > recordNodes(simpleName, reference); > } > fieldAccess.setSourceRange(receiver.getStartPosition(), reference.sourceEnd - receiver.getStartPosition() + 1); >+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=88548 >+ final Constant constant = reference.constant; >+ if (constant != null && constant != Constant.NotAConstant) { >+ fieldAccess.constant = convert(constant); >+ } > return fieldAccess; > } > } >@@ -1599,6 +1656,11 @@ > } > literal.setSourceRange(sourceStart, length); > removeLeadingAndTrailingCommentsFromLiteral(literal); >+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=88548 >+ final Constant constant = expression.constant; >+ if (constant != null && constant != Constant.NotAConstant) { >+ literal.constant = convert(constant); >+ } > return literal; > } > >@@ -1699,6 +1761,11 @@ > } > literal.setSourceRange(sourceStart, length); > removeLeadingAndTrailingCommentsFromLiteral(literal); >+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=88548 >+ final Constant constant = expression.constant; >+ if (constant != null && constant != Constant.NotAConstant) { >+ literal.constant = convert(constant); >+ } > return literal; > } > >@@ -1713,6 +1780,11 @@ > } > literal.setSourceRange(sourceStart, length); > removeLeadingAndTrailingCommentsFromLiteral(literal); >+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=88548 >+ final Constant constant = expression.constant; >+ if (constant != null && constant != Constant.NotAConstant) { >+ literal.constant = convert(constant); >+ } > return literal; > } > >@@ -1761,6 +1833,11 @@ > } > literal.setSourceRange(sourceStart, length); > removeLeadingAndTrailingCommentsFromLiteral(literal); >+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=88548 >+ final Constant constant = expression.constant; >+ if (constant != null && constant != Constant.NotAConstant) { >+ literal.constant = convert(constant); >+ } > return literal; > } > >@@ -1775,6 +1852,11 @@ > } > literal.setSourceRange(sourceStart, length); > removeLeadingAndTrailingCommentsFromLiteral(literal); >+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=88548 >+ final Constant constant = expression.constant; >+ if (constant != null && constant != Constant.NotAConstant) { >+ literal.constant = convert(constant); >+ } > return literal; > } > >@@ -1948,6 +2030,11 @@ > this.recordNodes(infixExpression, expression); > } > infixExpression.setSourceRange(expression.sourceStart, expression.sourceEnd - expression.sourceStart + 1); >+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=88548 >+ final Constant constant = expression.constant; >+ if (constant != null && constant != Constant.NotAConstant) { >+ infixExpression.constant = convert(constant); >+ } > return infixExpression; > } > >@@ -2088,7 +2175,13 @@ > } > > public Name convert(org.eclipse.jdt.internal.compiler.ast.QualifiedNameReference nameReference) { >- return setQualifiedNameNameAndSourceRanges(nameReference.tokens, nameReference.sourcePositions, nameReference); >+ Name name = setQualifiedNameNameAndSourceRanges(nameReference.tokens, nameReference.sourcePositions, nameReference); >+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=88548 >+ final Constant constant = nameReference.constant; >+ if (constant != null && constant != Constant.NotAConstant) { >+ name.constant = convert(constant); >+ } >+ return name; > } > > public Name convert(org.eclipse.jdt.internal.compiler.ast.QualifiedSuperReference reference) { >@@ -2151,6 +2244,11 @@ > recordNodes(name, nameReference); > } > name.setSourceRange(nameReference.sourceStart, nameReference.sourceEnd - nameReference.sourceStart + 1); >+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=88548 >+ final Constant constant = nameReference.constant; >+ if (constant != null && constant != Constant.NotAConstant) { >+ name.constant = convert(constant); >+ } > return name; > } > >@@ -2284,6 +2382,11 @@ > } > literal.setEscapedValue(new String(tokens)); > literal.setSourceRange(expression.sourceStart, expression.sourceEnd - expression.sourceStart + 1); >+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=88548 >+ final Constant constant = expression.constant; >+ if (constant != null && constant != Constant.NotAConstant) { >+ literal.constant = convert(constant); >+ } > return literal; > } > >@@ -2518,6 +2621,11 @@ > break; > case org.eclipse.jdt.internal.compiler.ast.OperatorIds.TWIDDLE : > prefixExpression.setOperator(PrefixExpression.Operator.COMPLEMENT); >+ } >+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=88548 >+ final Constant constant = expression.constant; >+ if (constant != null && constant != Constant.NotAConstant) { >+ prefixExpression.constant = convert(constant); > } > return prefixExpression; > } >Index: BooleanLiteral.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/BooleanLiteral.java,v >retrieving revision 1.16 >diff -u -r1.16 BooleanLiteral.java >--- BooleanLiteral.java 23 Feb 2005 02:47:27 -0000 1.16 >+++ BooleanLiteral.java 22 Mar 2005 15:09:33 -0000 >@@ -62,7 +62,7 @@ > public static List propertyDescriptors(int apiLevel) { > return PROPERTY_DESCRIPTORS; > } >- >+ > /** > * The boolean; defaults to the literal for <code>false</code>. > */ >@@ -102,7 +102,7 @@ > // allow default implementation to flag the error > return super.internalGetSetBooleanProperty(property, get, newValue); > } >- >+ > /* (omit javadoc for this method) > * Method declared on ASTNode. > */ >@@ -146,7 +146,14 @@ > public boolean booleanValue() { > return this.value; > } >- >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.jdt.core.dom.Expression#getConstant() >+ */ >+ public Object getConstant() { >+ return this.value ? Boolean.TRUE : Boolean.FALSE; >+ } >+ > /** > * Sets the boolean value of this boolean literal node. > * >Index: CastExpression.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/CastExpression.java,v >retrieving revision 1.21 >diff -u -r1.21 CastExpression.java >--- CastExpression.java 23 Feb 2005 02:47:27 -0000 1.21 >+++ CastExpression.java 22 Mar 2005 15:09:33 -0000 >@@ -82,6 +82,11 @@ > private Expression expression = null; > > /** >+ * The constant value of this expression if it has one. >+ */ >+ Object constant; >+ >+ /** > * Creates a new AST node for a cast expression owned by the given > * AST. By default, the type and expression are unspecified (but legal). > * <p> >@@ -140,6 +145,7 @@ > result.setSourceRange(this.getStartPosition(), this.getLength()); > result.setType((Type) getType().clone(target)); > result.setExpression((Expression) getExpression().clone(target)); >+ result.constant = this.constant; > return result; > } > >@@ -203,6 +209,9 @@ > postReplaceChild(oldChild, type, TYPE_PROPERTY); > } > >+ public Object getConstant() { >+ return this.constant; >+ } > /** > * Returns the expression of this cast expression. > * >@@ -248,7 +257,7 @@ > */ > int memSize() { > // treat Code as free >- return BASE_NODE_SIZE + 2 * 4; >+ return BASE_NODE_SIZE + 3 * 4; > } > > /* (omit javadoc for this method) >Index: CharacterLiteral.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/CharacterLiteral.java,v >retrieving revision 1.30 >diff -u -r1.30 CharacterLiteral.java >--- CharacterLiteral.java 23 Feb 2005 02:47:27 -0000 1.30 >+++ CharacterLiteral.java 22 Mar 2005 15:09:33 -0000 >@@ -60,7 +60,12 @@ > public static List propertyDescriptors(int apiLevel) { > return PROPERTY_DESCRIPTORS; > } >- >+ >+ /** >+ * The constant value of this expression if it has one. >+ */ >+ Object constant; >+ > /** > * The literal string, including quotes and escapes; defaults to the > * literal for the character 'X'. >@@ -136,6 +141,13 @@ > visitor.endVisit(this); > } > >+ /* (non-Javadoc) >+ * @see org.eclipse.jdt.core.dom.Expression#getConstant() >+ */ >+ public Object getConstant() { >+ return this.constant; >+ } >+ > /** > * Returns the string value of this literal node. The value is the sequence > * of characters that would appear in the source program, including >@@ -359,7 +371,7 @@ > * Method declared on ASTNode. > */ > int memSize() { >- int size = BASE_NODE_SIZE + 1 * 4 + stringSize(escapedValue); >+ int size = BASE_NODE_SIZE + 2 * 4 + stringSize(escapedValue); > return size; > } > >Index: ConditionalExpression.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ConditionalExpression.java,v >retrieving revision 1.21 >diff -u -r1.21 ConditionalExpression.java >--- ConditionalExpression.java 23 Feb 2005 02:47:27 -0000 1.21 >+++ ConditionalExpression.java 22 Mar 2005 15:09:33 -0000 >@@ -25,7 +25,7 @@ > * @since 2.0 > */ > public class ConditionalExpression extends Expression { >- >+ > /** > * The "expression" structural property of this node type. > * @since 3.0 >@@ -77,7 +77,12 @@ > public static List propertyDescriptors(int apiLevel) { > return PROPERTY_DESCRIPTORS; > } >- >+ >+ /** >+ * The constant value of this expression if it has one. >+ */ >+ Object constant; >+ > /** > * The condition expression; lazily initialized; defaults to an unspecified, > * but legal, expression. >@@ -148,7 +153,7 @@ > // allow default implementation to flag the error > return super.internalGetSetChildProperty(property, get, child); > } >- >+ > /* (omit javadoc for this method) > * Method declared on ASTNode. > */ >@@ -167,6 +172,7 @@ > (Expression) getThenExpression().clone(target)); > result.setElseExpression( > (Expression) getElseExpression().clone(target)); >+ result.constant = this.constant; > return result; > } > >@@ -192,6 +198,14 @@ > visitor.endVisit(this); > } > >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.jdt.core.dom.Expression#getConstant() >+ */ >+ public Object getConstant() { >+ return this.constant; >+ } >+ > /** > * Returns the condition of this conditional expression. > * >@@ -317,7 +331,7 @@ > */ > int memSize() { > // treat Code as free >- return BASE_NODE_SIZE + 3 * 4; >+ return BASE_NODE_SIZE + 4 * 4; > } > > /* (omit javadoc for this method) >Index: Expression.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Expression.java,v >retrieving revision 1.8 >diff -u -r1.8 Expression.java >--- Expression.java 23 Feb 2005 02:47:27 -0000 1.8 >+++ Expression.java 22 Mar 2005 15:09:33 -0000 >@@ -63,6 +63,23 @@ > } > > /** >+ * Returns this expression's constant value if it has one. >+ * Some expressions may have a value computed at compile-time. If the type of >+ * the value is a primitive type, the result is the boxed equivalent (i.e., >+ * int returned as an <code>Integer</code>). If the type of the value is >+ * <code>String</code>, the result is the string itself. If the variable has >+ * no compile-time computed value, the result is <code>null</code>. >+ * (Note: compile-time constant expressions cannot denote <code>null</code>; >+ * JLS2 15.28.). The result is always <code>null</code> for enum constants. >+ * >+ * @return the constant value, or <code>null</code> if none >+ * @since 3.1 >+ */ >+ public Object getConstant() { >+ return null; >+ } >+ >+ /** > * Resolves and returns the binding for the type of this expression. > * <p> > * Note that bindings are generally unavailable unless requested when the >Index: FieldAccess.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/FieldAccess.java,v >retrieving revision 1.26 >diff -u -r1.26 FieldAccess.java >--- FieldAccess.java 23 Feb 2005 02:47:27 -0000 1.26 >+++ FieldAccess.java 22 Mar 2005 15:09:33 -0000 >@@ -55,7 +55,7 @@ > * @since 2.0 > */ > public class FieldAccess extends Expression { >- >+ > /** > * The "expression" structural property of this node type. > * @since 3.0 >@@ -99,7 +99,12 @@ > public static List propertyDescriptors(int apiLevel) { > return PROPERTY_DESCRIPTORS; > } >- >+ >+ /** >+ * The constant value of this expression if it has one. >+ */ >+ Object constant; >+ > /** > * The expression; lazily initialized; defaults to an unspecified, > * but legal, simple name. >@@ -172,6 +177,7 @@ > result.setSourceRange(this.getStartPosition(), this.getLength()); > result.setExpression((Expression) getExpression().clone(target)); > result.setName((SimpleName) getName().clone(target)); >+ result.constant = this.constant; > return result; > } > >@@ -196,6 +202,13 @@ > visitor.endVisit(this); > } > >+ /* (non-Javadoc) >+ * @see org.eclipse.jdt.core.dom.Expression#getConstant() >+ */ >+ public Object getConstant() { >+ return this.constant; >+ } >+ > /** > * Returns the expression of this field access expression. > * >@@ -280,7 +293,7 @@ > */ > int memSize() { > // treat Code as free >- return BASE_NODE_SIZE + 2 * 4; >+ return BASE_NODE_SIZE + 3 * 4; > } > > /** >Index: InfixExpression.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/InfixExpression.java,v >retrieving revision 1.27 >diff -u -r1.27 InfixExpression.java >--- InfixExpression.java 23 Feb 2005 02:47:27 -0000 1.27 >+++ InfixExpression.java 22 Mar 2005 15:09:33 -0000 >@@ -171,7 +171,7 @@ > } > > } >- >+ > /** > * The "leftOperand" structural property of this node type. > * @since 3.0 >@@ -231,7 +231,12 @@ > public static List propertyDescriptors(int apiLevel) { > return PROPERTY_DESCRIPTORS; > } >- >+ >+ /** >+ * The constant value of this expression if it has one. >+ */ >+ Object constant; >+ > /** > * The infix operator; defaults to InfixExpression.Operator.PLUS. > */ >@@ -345,6 +350,7 @@ > result.extendedOperands().addAll( > ASTNode.copySubtrees(target, this.extendedOperands())); > } >+ result.constant = this.constant; > return result; > } > >@@ -372,7 +378,14 @@ > } > visitor.endVisit(this); > } >- >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.jdt.core.dom.Expression#getConstant() >+ */ >+ public Object getConstant() { >+ return this.constant; >+ } >+ > /** > * Returns the operator of this infix expression. > * >@@ -521,7 +534,7 @@ > */ > int memSize() { > // treat Operator as free >- return BASE_NODE_SIZE + 4 * 4; >+ return BASE_NODE_SIZE + 5 * 4; > } > > /* (omit javadoc for this method) >Index: Name.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Name.java,v >retrieving revision 1.13 >diff -u -r1.13 Name.java >--- Name.java 23 Feb 2005 02:47:27 -0000 1.13 >+++ Name.java 22 Mar 2005 15:09:33 -0000 >@@ -31,9 +31,14 @@ > * Approximate base size of an expression node instance in bytes, > * including object header and instance fields. > */ >- static final int BASE_NAME_NODE_SIZE = BASE_NODE_SIZE + 1 * 4; >+ static final int BASE_NAME_NODE_SIZE = BASE_NODE_SIZE + 2 * 4; > > /** >+ * The constant value of this expression if it has one. >+ */ >+ Object constant; >+ >+ /** > * This index represents the position inside a qualified name. > */ > int index; >@@ -50,6 +55,13 @@ > super(ast); > } > >+ /* (non-Javadoc) >+ * @see org.eclipse.jdt.core.dom.Expression#getConstant() >+ */ >+ public Object getConstant() { >+ return this.constant; >+ } >+ > /** > * Returns whether this name is a simple name > * (<code>SimpleName</code>). >Index: NumberLiteral.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/NumberLiteral.java,v >retrieving revision 1.28 >diff -u -r1.28 NumberLiteral.java >--- NumberLiteral.java 23 Feb 2005 02:47:27 -0000 1.28 >+++ NumberLiteral.java 22 Mar 2005 15:09:33 -0000 >@@ -62,6 +62,11 @@ > } > > /** >+ * The constant value of this expression if it has one. >+ */ >+ Object constant; >+ >+ /** > * The token string; defaults to the integer literal "0". > */ > private String tokenValue = "0";//$NON-NLS-1$ >@@ -116,6 +121,7 @@ > NumberLiteral result = new NumberLiteral(target); > result.setSourceRange(this.getStartPosition(), this.getLength()); > result.setToken(getToken()); >+ result.constant = this.constant; > return result; > } > >@@ -134,6 +140,13 @@ > visitor.visit(this); > visitor.endVisit(this); > } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.jdt.core.dom.Expression#getConstant() >+ */ >+ public Object getConstant() { >+ return this.constant; >+ } > > /** > * Returns the token of this number literal node. The value is the sequence >@@ -200,7 +213,7 @@ > * Method declared on ASTNode. > */ > int memSize() { >- int size = BASE_NODE_SIZE + 1 * 4 + stringSize(tokenValue); >+ int size = BASE_NODE_SIZE + 2 * 4 + stringSize(tokenValue); > return size; > } > >Index: PostfixExpression.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/PostfixExpression.java,v >retrieving revision 1.22 >diff -u -r1.22 PostfixExpression.java >--- PostfixExpression.java 23 Feb 2005 02:47:27 -0000 1.22 >+++ PostfixExpression.java 22 Mar 2005 15:09:33 -0000 >@@ -102,7 +102,7 @@ > return (Operator) CODES.get(token); > } > } >- >+ > /** > * The "operator" structural property of this node type. > * @since 3.0 >@@ -148,6 +148,11 @@ > } > > /** >+ * The constant value of this expression if it has one. >+ */ >+ Object constant; >+ >+ /** > * The operator; defaults to an unspecified postfix operator. > */ > private PostfixExpression.Operator operator = >@@ -224,6 +229,7 @@ > result.setSourceRange(this.getStartPosition(), this.getLength()); > result.setOperator(getOperator()); > result.setOperand((Expression) getOperand().clone(target)); >+ result.constant = this.constant; > return result; > } > >@@ -246,6 +252,13 @@ > visitor.endVisit(this); > } > >+ /* (non-Javadoc) >+ * @see org.eclipse.jdt.core.dom.Expression#getConstant() >+ */ >+ public Object getConstant() { >+ return this.constant; >+ } >+ > /** > * Returns the operator of this postfix expression. > * >@@ -315,7 +328,7 @@ > */ > int memSize() { > // treat Operator as free >- return BASE_NODE_SIZE + 2 * 4; >+ return BASE_NODE_SIZE + 3 * 4; > } > > /* (omit javadoc for this method) >Index: PrefixExpression.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/PrefixExpression.java,v >retrieving revision 1.23 >diff -u -r1.23 PrefixExpression.java >--- PrefixExpression.java 23 Feb 2005 02:47:27 -0000 1.23 >+++ PrefixExpression.java 22 Mar 2005 15:09:33 -0000 >@@ -118,7 +118,7 @@ > return (Operator) CODES.get(token); > } > } >- >+ > /** > * The "operator" structural property of this node type. > * @since 3.0 >@@ -162,7 +162,12 @@ > public static List propertyDescriptors(int apiLevel) { > return PROPERTY_DESCRIPTORS; > } >- >+ >+ /** >+ * The constant value of this expression if it has one. >+ */ >+ Object constant; >+ > /** > * The operator; defaults to an unspecified prefix operator. > */ >@@ -240,6 +245,7 @@ > result.setSourceRange(this.getStartPosition(), this.getLength()); > result.setOperator(getOperator()); > result.setOperand((Expression) getOperand().clone(target)); >+ result.constant = this.constant; > return result; > } > >@@ -263,6 +269,13 @@ > visitor.endVisit(this); > } > >+ /* (non-Javadoc) >+ * @see org.eclipse.jdt.core.dom.Expression#getConstant() >+ */ >+ public Object getConstant() { >+ return this.constant; >+ } >+ > /** > * Returns the operator of this prefix expression. > * >@@ -332,7 +345,7 @@ > */ > int memSize() { > // treat Operator as free >- return BASE_NODE_SIZE + 2 * 4; >+ return BASE_NODE_SIZE + 3 * 4; > } > > /* (omit javadoc for this method) >Index: QualifiedName.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/QualifiedName.java,v >retrieving revision 1.35 >diff -u -r1.35 QualifiedName.java >--- QualifiedName.java 23 Feb 2005 02:47:27 -0000 1.35 >+++ QualifiedName.java 22 Mar 2005 15:09:33 -0000 >@@ -32,7 +32,7 @@ > * @since 2.0 > */ > public class QualifiedName extends Name { >- >+ > /** > * The "qualifier" structural property of this node type. > * @since 3.0 >@@ -148,6 +148,7 @@ > result.setSourceRange(this.getStartPosition(), this.getLength()); > result.setQualifier((Name) getQualifier().clone(target)); > result.setName((SimpleName) getName().clone(target)); >+ result.constant = this.constant; > return result; > } > >Index: SimpleName.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SimpleName.java,v >retrieving revision 1.40 >diff -u -r1.40 SimpleName.java >--- SimpleName.java 12 Mar 2005 16:36:47 -0000 1.40 >+++ SimpleName.java 22 Mar 2005 15:09:33 -0000 >@@ -129,6 +129,7 @@ > SimpleName result = new SimpleName(target); > result.setSourceRange(this.getStartPosition(), this.getLength()); > result.setIdentifier(getIdentifier()); >+ result.constant = this.constant; > return result; > } > >Index: StringLiteral.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/StringLiteral.java,v >retrieving revision 1.32 >diff -u -r1.32 StringLiteral.java >--- StringLiteral.java 23 Feb 2005 02:47:27 -0000 1.32 >+++ StringLiteral.java 22 Mar 2005 15:09:33 -0000 >@@ -60,7 +60,12 @@ > public static List propertyDescriptors(int apiLevel) { > return PROPERTY_DESCRIPTORS; > } >- >+ >+ /** >+ * The constant value of this expression if it has one. >+ */ >+ Object constant; >+ > /** > * The literal string, including quotes and escapes; defaults to the > * literal for the empty string. >@@ -117,6 +122,7 @@ > StringLiteral result = new StringLiteral(target); > result.setSourceRange(this.getStartPosition(), this.getLength()); > result.setEscapedValue(getEscapedValue()); >+ result.constant = this.constant; > return result; > } > >@@ -136,6 +142,13 @@ > visitor.endVisit(this); > } > >+ /* (non-Javadoc) >+ * @see org.eclipse.jdt.core.dom.Expression#getConstant() >+ */ >+ public Object getConstant() { >+ return this.constant; >+ } >+ > /** > * Returns the string value of this literal node to the given string > * literal token. The token is the sequence of characters that would appear >@@ -321,7 +334,7 @@ > * Method declared on ASTNode. > */ > int memSize() { >- int size = BASE_NODE_SIZE + 1 * 4 + stringSize(escapedValue); >+ int size = BASE_NODE_SIZE + 2 * 4 + stringSize(escapedValue); > return size; > } > >Index: SuperFieldAccess.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SuperFieldAccess.java,v >retrieving revision 1.24 >diff -u -r1.24 SuperFieldAccess.java >--- SuperFieldAccess.java 23 Feb 2005 02:47:27 -0000 1.24 >+++ SuperFieldAccess.java 22 Mar 2005 15:09:33 -0000 >@@ -76,6 +76,11 @@ > } > > /** >+ * The constant value of this expression if it has one. >+ */ >+ Object constant; >+ >+ /** > * The optional qualifier; <code>null</code> for none; defaults to none. > */ > private Name optionalQualifier = null; >@@ -146,6 +151,7 @@ > result.setSourceRange(this.getStartPosition(), this.getLength()); > result.setName((SimpleName) ASTNode.copySubtree(target, getName())); > result.setQualifier((Name) ASTNode.copySubtree(target, getQualifier())); >+ result.constant = this.constant; > return result; > } > >@@ -170,6 +176,13 @@ > visitor.endVisit(this); > } > >+ /* (non-Javadoc) >+ * @see org.eclipse.jdt.core.dom.Expression#getConstant() >+ */ >+ public Object getConstant() { >+ return this.constant; >+ } >+ > /** > * Returns the qualifier of this "super" field access expression, or > * <code>null</code> if there is none. >@@ -260,7 +273,7 @@ > */ > int memSize() { > // treat Code as free >- return BASE_NODE_SIZE + 2 * 4; >+ return BASE_NODE_SIZE + 3 * 4; > } > > /* (omit javadoc for this method)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 88548
:
19066
|
19067
|
19068
| 19078