File tree Expand file tree Collapse file tree 2 files changed +5
-13
lines changed
Expand file tree Collapse file tree 2 files changed +5
-13
lines changed Original file line number Diff line number Diff line change 11---
22category : minorAnalysis
33---
4- * Add new method ` CharacterLiteral .getStringifiedValue` which attempts to compute the
5- ` String.valueOf ` compile time constant value of the expression.
4+ * Add new method ` CompileTimeConstantExpr .getStringifiedValue` which attempts to compute the
5+ ` String.valueOf ` string rendering of a constant expression.
Original file line number Diff line number Diff line change @@ -201,17 +201,9 @@ class CompileTimeConstantExpr extends Expr {
201201 result = this .( StringLiteral ) .getValue ( )
202202 or
203203 (
204- if this .( AddExpr ) .getAnOperand ( ) .getType ( ) instanceof TypeString // If either operand type is already a String:
205- then
206- // Then the stringified version of the expression can be safely used as a String will be created.
207- result =
208- this .( AddExpr ) .getLeftOperand ( ) .( CompileTimeConstantExpr ) .getStringifiedValue ( ) +
209- this .( AddExpr ) .getRightOperand ( ) .( CompileTimeConstantExpr ) .getStringifiedValue ( )
210- else
211- // Adding two literals of primitive type will not result in a String.
212- result =
213- this .( AddExpr ) .getLeftOperand ( ) .( CompileTimeConstantExpr ) .getStringValue ( ) +
214- this .( AddExpr ) .getRightOperand ( ) .( CompileTimeConstantExpr ) .getStringValue ( )
204+ this .getType ( ) instanceof TypeString and
205+ this .( AddExpr ) .getLeftOperand ( ) .( CompileTimeConstantExpr ) .getStringifiedValue ( ) +
206+ this .( AddExpr ) .getRightOperand ( ) .( CompileTimeConstantExpr ) .getStringifiedValue ( )
215207 )
216208 or
217209 // Ternary conditional, with compile-time constant condition.
You can’t perform that action at this time.
0 commit comments