Skip to content

Commit b5db404

Browse files
committed
JS: Exclude template files in SelfAssignment
1 parent db78e3a commit b5db404

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

javascript/ql/src/Expressions/SelfAssignment.ql

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,8 @@ where
4343
// exclude DOM properties
4444
not isDOMProperty(e.(PropAccess).getPropertyName()) and
4545
// exclude self-assignments that have been inserted to satisfy the TypeScript JS-checker
46-
not e.getAssignment().getParent().(ExprStmt).getDocumentation().getATag().getTitle() = "type"
46+
not e.getAssignment().getParent().(ExprStmt).getDocumentation().getATag().getTitle() = "type" and
47+
// exclude self-assignments in speculatively parsed template files
48+
// named arguments may be incorrectly parsed as assignments
49+
not e.getTopLevel() instanceof Templating::TemplateTopLevel
4750
select e.getParent(), "This expression assigns " + dsc + " to itself."
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<div>
2+
{{ foo(x=x) }}
3+
</div>

0 commit comments

Comments
 (0)