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 @@ -1648,13 +1648,19 @@ private string getConstantString(Expr e) {
16481648 result = e .( TemplateElement ) .getValue ( )
16491649}
16501650
1651+ pragma [ nomagic]
1652+ private predicate hasConstantStringValue ( Expr e ) {
1653+ exists ( getConstantString ( e ) )
1654+ or
1655+ hasAllConstantLeafs ( e .getUnderlyingValue ( ) )
1656+ }
1657+
16511658/**
16521659 * Holds if `add` is a string-concatenation where all the transitive leafs have a constant string value.
16531660 */
16541661private predicate hasAllConstantLeafs ( AddExpr add ) {
1655- forex ( Expr leaf | leaf = getAnAddOperand * ( add ) and not exists ( getAnAddOperand ( leaf ) ) |
1656- exists ( getConstantString ( leaf ) )
1657- )
1662+ hasConstantStringValue ( add .getLeftOperand ( ) ) and
1663+ hasConstantStringValue ( add .getRightOperand ( ) )
16581664}
16591665
16601666/**
You can’t perform that action at this time.
0 commit comments