File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
javascript/ql/lib/semmle/javascript Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -1618,13 +1618,19 @@ private string getConstantString(Expr e) {
16181618 result = e .( TemplateElement ) .getValue ( )
16191619}
16201620
1621+ pragma [ nomagic]
1622+ private predicate hasConstantStringValue ( Expr e ) {
1623+ exists ( getConstantString ( e ) )
1624+ or
1625+ hasAllConstantLeafs ( e .getUnderlyingValue ( ) )
1626+ }
1627+
16211628/**
16221629 * Holds if `add` is a string-concatenation where all the transitive leafs have a constant string value.
16231630 */
16241631private predicate hasAllConstantLeafs ( AddExpr add ) {
1625- forex ( Expr leaf | leaf = getAnAddOperand * ( add ) and not exists ( getAnAddOperand ( leaf ) ) |
1626- exists ( getConstantString ( leaf ) )
1627- )
1632+ hasConstantStringValue ( add .getLeftOperand ( ) ) and
1633+ hasConstantStringValue ( add .getRightOperand ( ) )
16281634}
16291635
16301636/**
You can’t perform that action at this time.
0 commit comments