File tree Expand file tree Collapse file tree 2 files changed +6
-4
lines changed
ql/test/library-tests/CallGraphs/AnnotatedTest Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -1255,9 +1255,12 @@ public Void visit(Literal nd, SuccessorInfo i) {
1255
1255
1256
1256
@ Override
1257
1257
public Void visit (BlockStatement nd , SuccessorInfo i ) {
1258
- if (nd .getBody ().isEmpty ()) writeSuccessors (nd , i .getAllSuccessors ());
1259
- else writeSuccessor (nd , First .of (nd .getBody ().get (0 )));
1260
- visitSequence (nd .getBody (), i .getAllSuccessors ());
1258
+ // Hoist function declarations in a block statement to the top of the block.
1259
+ // This reflects non-standard behaviour implemented by most engines.
1260
+ // See also: EcmaScript "B.3.2 Block-Level Function Declarations Web Legacy Compatibility Semantics".
1261
+ List <Identifier > hoisted = HoistedFunDecls .of (nd .getBody ());
1262
+ hoistedFns .addAll (hoisted );
1263
+ writeSuccessors (nd , visitSequence (hoisted , nd .getBody (), i .getAllSuccessors ()));
1261
1264
return null ;
1262
1265
}
1263
1266
Original file line number Diff line number Diff line change @@ -2,7 +2,6 @@ spuriousCallee
2
2
missingCallee
3
3
| constructor-field.ts:40:5:40:14 | f3.build() | constructor-field.ts:13:3:13:12 | build() {} | -1 | calls |
4
4
| constructor-field.ts:71:1:71:11 | bf3.build() | constructor-field.ts:13:3:13:12 | build() {} | -1 | calls |
5
- | hoisted.js:20:9:20:11 | f() | hoisted.js:23:9:23:23 | function f() {} | -1 | calls |
6
5
badAnnotation
7
6
accessorCall
8
7
| accessors.js:12:1:12:5 | obj.f | accessors.js:5:8:5:12 | () {} |
You can’t perform that action at this time.
0 commit comments