Skip to content

Commit 0997da0

Browse files
committed
Improvements to PathConcatenation, but restricted by PathExpr legacy
1 parent ad57887 commit 0997da0

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

javascript/ql/lib/semmle/javascript/internal/paths/PathConcatenation.qll

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
private import javascript
22

33
/**
4-
* A path expression that can be constant-folded by concatenating other paths.
4+
* A path expression that can be constant-folded by concatenating subexpressions.
55
*/
66
abstract class PathConcatenation extends Expr {
77
/** Gets the separator to insert between paths */
@@ -19,10 +19,14 @@ private class AddExprConcatenation extends PathConcatenation, AddExpr {
1919
}
2020
}
2121

22+
private class TemplateConcatenation extends PathConcatenation, TemplateLiteral {
23+
override Expr getOperand(int n) { result = this.getElement(n) }
24+
}
25+
2226
private class JoinCallConcatenation extends PathConcatenation, CallExpr {
2327
JoinCallConcatenation() {
2428
this.getReceiver().(VarAccess).getName() = "path" and
25-
this.getCalleeName() = "join"
29+
this.getCalleeName() = ["join", "resolve"]
2630
}
2731

2832
override Expr getOperand(int n) { result = this.getArgument(n) }

0 commit comments

Comments
 (0)