mirror of
https://github.com/github/codeql.git
synced 2026-05-04 05:05:12 +02:00
Apply suggestions from code review
Co-authored-by: Chris Smowton <smowton@github.com>
This commit is contained in:
committed by
GitHub
parent
2e8b5f743b
commit
65457cc2e2
@@ -201,17 +201,9 @@ class CompileTimeConstantExpr extends Expr {
|
||||
result = this.(StringLiteral).getValue()
|
||||
or
|
||||
(
|
||||
if this.(AddExpr).getAnOperand().getType() instanceof TypeString // If either operand type is already a String:
|
||||
then
|
||||
// Then the stringified version of the expression can be safely used as a String will be created.
|
||||
result =
|
||||
this.(AddExpr).getLeftOperand().(CompileTimeConstantExpr).getStringifiedValue() +
|
||||
this.(AddExpr).getRightOperand().(CompileTimeConstantExpr).getStringifiedValue()
|
||||
else
|
||||
// Adding two literals of primitive type will not result in a String.
|
||||
result =
|
||||
this.(AddExpr).getLeftOperand().(CompileTimeConstantExpr).getStringValue() +
|
||||
this.(AddExpr).getRightOperand().(CompileTimeConstantExpr).getStringValue()
|
||||
this.getType() instanceof TypeString and
|
||||
this.(AddExpr).getLeftOperand().(CompileTimeConstantExpr).getStringifiedValue() +
|
||||
this.(AddExpr).getRightOperand().(CompileTimeConstantExpr).getStringifiedValue()
|
||||
)
|
||||
or
|
||||
// Ternary conditional, with compile-time constant condition.
|
||||
|
||||
Reference in New Issue
Block a user