File tree Expand file tree Collapse file tree 3 files changed +33
-2
lines changed
test/query-tests/Expressions/MissingAwait Expand file tree Collapse file tree 3 files changed +33
-2
lines changed Original file line number Diff line number Diff line change @@ -46,6 +46,14 @@ predicate isBadPromiseContext(Expr expr) {
4646 expr = any ( UnaryExpr e ) .getOperand ( )
4747 or
4848 expr = any ( UpdateExpr e ) .getOperand ( )
49+ or
50+ expr = any ( ConditionalExpr e ) .getCondition ( )
51+ or
52+ expr = any ( IfStmt stmt ) .getCondition ( )
53+ or
54+ expr = any ( ForInStmt stmt ) .getIterationDomain ( )
55+ or
56+ expr = any ( IndexExpr e ) .getIndex ( )
4957}
5058
5159string tryGetPromiseExplanation ( Expr e ) {
Original file line number Diff line number Diff line change 11| tst.js:8:9:8:13 | thing | Missing await. The value 'thing' is always a promise. |
2- | tst.js:32:12:32:16 | thing | Missing await. The value 'thing' is always a promise. |
2+ | tst.js:10:9:10:13 | thing | Missing await. The value 'thing' is always a promise. |
3+ | tst.js:12:15:12:19 | thing | Missing await. The value 'thing' is always a promise. |
4+ | tst.js:14:19:14:23 | thing | Missing await. The value 'thing' is always a promise. |
5+ | tst.js:19:19:19:23 | thing | Missing await. The value 'thing' is always a promise. |
6+ | tst.js:20:9:20:13 | thing | Missing await. The value 'thing' is always a promise. |
7+ | tst.js:22:15:22:19 | thing | Missing await. The value 'thing' is always a promise. |
8+ | tst.js:25:13:25:17 | thing | Missing await. The value 'thing' is always a promise. |
9+ | tst.js:48:12:48:16 | thing | Missing await. The value 'thing' is always a promise. |
Original file line number Diff line number Diff line change @@ -9,7 +9,23 @@ function useThing() {
99
1010 if ( thing == null ) { } // NOT OK
1111
12- return thing + "bar" ; // NOT OK
12+ something ( thing ? 1 : 2 ) ; // NOT OK
13+
14+ for ( let x in thing ) { // NOT OK
15+ something ( x ) ;
16+ }
17+
18+ let obj = something ( ) ;
19+ something ( obj [ thing ] ) ; // NOT OK
20+ obj [ thing ] = 5 ; // NOT OK
21+
22+ something ( thing + "bar" ) ; // NOT OK
23+
24+ if ( something ( ) ) {
25+ if ( thing ) { // NOT OK
26+ something ( 3 ) ;
27+ }
28+ }
1329}
1430
1531async function useThingCorrectly ( ) {
You can’t perform that action at this time.
0 commit comments