JS: Exclude template files in SelfAssignment

This commit is contained in:
Asger Feldthaus
2021-09-15 08:59:47 +02:00
parent db78e3a7da
commit b5db4047a0
2 changed files with 7 additions and 1 deletions

View File

@@ -43,5 +43,8 @@ where
// exclude DOM properties
not isDOMProperty(e.(PropAccess).getPropertyName()) and
// exclude self-assignments that have been inserted to satisfy the TypeScript JS-checker
not e.getAssignment().getParent().(ExprStmt).getDocumentation().getATag().getTitle() = "type"
not e.getAssignment().getParent().(ExprStmt).getDocumentation().getATag().getTitle() = "type" and
// exclude self-assignments in speculatively parsed template files
// named arguments may be incorrectly parsed as assignments
not e.getTopLevel() instanceof Templating::TemplateTopLevel
select e.getParent(), "This expression assigns " + dsc + " to itself."