File tree Expand file tree Collapse file tree 3 files changed +5
-6
lines changed
test/query-tests/Expressions/ExprHasNoEffect Expand file tree Collapse file tree 3 files changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -178,6 +178,8 @@ predicate hasNoEffect(Expr e) {
178
178
e .getParent ( ) = parent and
179
179
e .getLastToken ( ) .getNextToken ( ) .getValue ( ) = ":"
180
180
) and
181
+ // exclude expressions that are part of a conditional expression
182
+ not exists ( ConditionalExpr cond | e .getParent ( ) = cond ) and
181
183
// exclude the first statement of a try block
182
184
not e = any ( TryStmt stmt ) .getBody ( ) .getStmt ( 0 ) .( ExprStmt ) .getExpr ( ) and
183
185
// 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:77:24:77:24 | o | This expression has no effect. |
15
- | tst.js:83:43:83:46 | null | This expression has no effect. |
16
- | tst.js:84:42:84:45 | null | This expression has no effect. |
17
14
| uselessfn.js:1:2:1:26 | functio ... d.");\\n} | This expression has no effect. |
Original file line number Diff line number Diff line change @@ -74,12 +74,12 @@ function g() {
74
74
75
75
( o : empty ) ;
76
76
77
- testSomeCondition ( ) ? o : // $ Alert
77
+ testSomeCondition ( ) ? o :
78
78
doSomethingDangerous ( ) ;
79
79
80
80
consume ( testSomeCondition ( ) ? o :
81
81
doSomethingDangerous ( ) ) ;
82
82
83
- ( "release" === isRelease ( ) ? warning ( ) : null ) ; // $ Alert
84
- "release" === isRelease ( ) ? warning ( ) : null ; // $ Alert
83
+ ( "release" === isRelease ( ) ? warning ( ) : null ) ;
84
+ "release" === isRelease ( ) ? warning ( ) : null ;
85
85
} ;
You can’t perform that action at this time.
0 commit comments