Skip to content

Commit c9537f2

Browse files
authored
Merge pull request github#5029 from asgerf/js/silence-angular-template-fps
Approved by erik-krogh
2 parents cb195a0 + 1637b72 commit c9537f2

File tree

4 files changed

+10
-3
lines changed

4 files changed

+10
-3
lines changed

javascript/ql/src/Declarations/DeadStoreOfLocal.ql

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,5 +68,7 @@ where
6868
not exists(SsaImplicitInit init | init.getVariable().getSourceVariable() = v) // the variable is dead at the hoisted implicit initialization.
6969
then msg = "The initial value of " + v.getName() + " is unused, since it is always overwritten."
7070
else msg = "The value assigned to " + v.getName() + " here is unused."
71-
)
71+
) and
72+
// ignore Angular templates
73+
not dead.(ASTNode).getTopLevel() instanceof Angular2::TemplateTopLevel
7274
select dead, msg

javascript/ql/src/Declarations/DeadStoreOfProperty.ql

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,9 @@ where
299299
assign1 instanceof CallToObjectDefineProperty
300300
implies
301301
assign1.(CallToObjectDefineProperty).hasPropertyAttributeWrite("value", _)
302-
)
302+
) and
303+
// ignore Angular templates
304+
not assign1.getTopLevel() instanceof Angular2::TemplateTopLevel
303305
select assign1.getWriteNode(),
304306
"This write to property '" + name + "' is useless, since $@ always overrides it.",
305307
assign2.getWriteNode(), "another property write"

javascript/ql/src/Expressions/ExprHasNoEffect.qll

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,5 +164,7 @@ predicate hasNoEffect(Expr e) {
164164
top = e.getParent().(ExprStmt).getParent() and
165165
top.getNumChild() = 1 and
166166
not exists(Function fun | fun.getEnclosingContainer() = top)
167-
)
167+
) and
168+
// ignore Angular templates
169+
not e.getTopLevel() instanceof Angular2::TemplateTopLevel
168170
}

javascript/ql/src/LanguageFeatures/SyntaxError.ql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,5 @@
1313
import javascript
1414

1515
from JSParseError pe
16+
where not pe.getTopLevel() instanceof Angular2::TemplateTopLevel
1617
select pe, pe.getMessage()

0 commit comments

Comments
 (0)