File tree Expand file tree Collapse file tree 3 files changed +5
-3
lines changed
test/query-tests/Expressions/ExprHasNoEffect Expand file tree Collapse file tree 3 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -174,7 +174,10 @@ predicate hasNoEffect(Expr e) {
174
174
not exists ( fe .getName ( ) )
175
175
) and
176
176
// exclude block-level flow type annotations. For example: `(name: empty)`.
177
- not e .( ParExpr ) .getExpression ( ) .getLastToken ( ) .getNextToken ( ) .getValue ( ) = ":" and
177
+ not exists ( ParExpr parent |
178
+ e .getParent ( ) = parent and
179
+ e .getLastToken ( ) .getNextToken ( ) .getValue ( ) = ":"
180
+ ) and
178
181
// exclude the first statement of a try block
179
182
not e = any ( TryStmt stmt ) .getBody ( ) .getStmt ( 0 ) .( ExprStmt ) .getExpr ( ) and
180
183
// exclude expressions that are alone in a file, and file doesn't contain a function.
Original file line number Diff line number Diff line change 11
11
| tst.js:49:3:49:49 | new Syn ... o me?") | This expression has no effect. |
12
12
| tst.js:50:3:50:36 | new Err ... age(e)) | This expression has no effect. |
13
13
| tst.js:61:2:61:20 | o.trivialNonGetter1 | This expression has no effect. |
14
- | tst.js:75:3:75:3 | o | This expression has no effect. |
15
14
| tst.js:77:24:77:24 | o | This expression has no effect. |
16
15
| uselessfn.js:1:2:1:26 | functio ... d.");\\n} | This expression has no effect. |
Original file line number Diff line number Diff line change @@ -72,7 +72,7 @@ function g() {
72
72
Object . defineProperty ( o , "nonTrivialGetter2" , unknownGetterDef ( ) ) ;
73
73
o . nonTrivialGetter2 ;
74
74
75
- ( o : empty ) ; // $SPURIOUS:Alert
75
+ ( o : empty ) ;
76
76
77
77
testSomeCondition ( ) ? o : // $ Alert
78
78
doSomethingDangerous ( ) ;
You can’t perform that action at this time.
0 commit comments