Skip to content

Commit 60944a9

Browse files
committed
JS: Accept new trap files
As I see it, these all seem to have invalid code initially anyway, but this is definitely something a JS expert should review :)
1 parent 1d51d18 commit 60944a9

File tree

6 files changed

+121
-157
lines changed

6 files changed

+121
-157
lines changed

javascript/extractor/tests/flow/output/trap/anonFunctionWithoutParens.js.trap

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -72,20 +72,14 @@ locations_default(#20025,#10000,1,40,1,39)
7272
hasLocation(#20024,#20025)
7373
toplevels(#20001,0)
7474
hasLocation(#20001,#20003)
75-
#20026=@"module;{#10000},1,1"
76-
scopes(#20026,3)
77-
scopenodes(#20001,#20026)
78-
scopenesting(#20026,#20000)
79-
is_module(#20001)
80-
is_es2015_module(#20001)
81-
#20027=*
82-
entry_cfg_node(#20027,#20001)
83-
#20028=@"loc,{#10000},1,1,1,0"
84-
locations_default(#20028,#10000,1,1,1,0)
85-
hasLocation(#20027,#20028)
86-
#20029=*
87-
exit_cfg_node(#20029,#20001)
88-
hasLocation(#20029,#20025)
89-
successor(#20027,#20029)
75+
#20026=*
76+
entry_cfg_node(#20026,#20001)
77+
#20027=@"loc,{#10000},1,1,1,0"
78+
locations_default(#20027,#10000,1,1,1,0)
79+
hasLocation(#20026,#20027)
80+
#20028=*
81+
exit_cfg_node(#20028,#20001)
82+
hasLocation(#20028,#20025)
83+
successor(#20026,#20028)
9084
numlines(#10000,1,1,0)
9185
filetype(#10000,"javascript")

javascript/extractor/tests/flow/output/trap/anonIndexer.js.trap

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -85,20 +85,14 @@ toplevels(#20001,0)
8585
#20030=@"loc,{#10000},1,1,2,0"
8686
locations_default(#20030,#10000,1,1,2,0)
8787
hasLocation(#20001,#20030)
88-
#20031=@"module;{#10000},1,1"
89-
scopes(#20031,3)
90-
scopenodes(#20001,#20031)
91-
scopenesting(#20031,#20000)
92-
is_module(#20001)
93-
is_es2015_module(#20001)
94-
#20032=*
95-
entry_cfg_node(#20032,#20001)
96-
#20033=@"loc,{#10000},1,1,1,0"
97-
locations_default(#20033,#10000,1,1,1,0)
98-
hasLocation(#20032,#20033)
99-
#20034=*
100-
exit_cfg_node(#20034,#20001)
101-
hasLocation(#20034,#20029)
102-
successor(#20032,#20034)
88+
#20031=*
89+
entry_cfg_node(#20031,#20001)
90+
#20032=@"loc,{#10000},1,1,1,0"
91+
locations_default(#20032,#10000,1,1,1,0)
92+
hasLocation(#20031,#20032)
93+
#20033=*
94+
exit_cfg_node(#20033,#20001)
95+
hasLocation(#20033,#20029)
96+
successor(#20031,#20033)
10397
numlines(#10000,1,1,0)
10498
filetype(#10000,"javascript")

javascript/extractor/tests/flow/output/trap/declared-module-imports.js.trap

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -128,20 +128,14 @@ toplevels(#20001,0)
128128
#20045=@"loc,{#10000},1,1,5,0"
129129
locations_default(#20045,#10000,1,1,5,0)
130130
hasLocation(#20001,#20045)
131-
#20046=@"module;{#10000},1,1"
132-
scopes(#20046,3)
133-
scopenodes(#20001,#20046)
134-
scopenesting(#20046,#20000)
135-
is_module(#20001)
136-
is_es2015_module(#20001)
137-
#20047=*
138-
entry_cfg_node(#20047,#20001)
139-
#20048=@"loc,{#10000},1,1,1,0"
140-
locations_default(#20048,#10000,1,1,1,0)
141-
hasLocation(#20047,#20048)
142-
#20049=*
143-
exit_cfg_node(#20049,#20001)
144-
hasLocation(#20049,#20044)
145-
successor(#20047,#20049)
131+
#20046=*
132+
entry_cfg_node(#20046,#20001)
133+
#20047=@"loc,{#10000},1,1,1,0"
134+
locations_default(#20047,#10000,1,1,1,0)
135+
hasLocation(#20046,#20047)
136+
#20048=*
137+
exit_cfg_node(#20048,#20001)
138+
hasLocation(#20048,#20044)
139+
successor(#20046,#20048)
146140
numlines(#10000,4,4,0)
147141
filetype(#10000,"javascript")

javascript/extractor/tests/flow/output/trap/exportOpaqueType.js.trap

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -70,20 +70,14 @@ toplevels(#20001,0)
7070
#20024=@"loc,{#10000},1,1,2,0"
7171
locations_default(#20024,#10000,1,1,2,0)
7272
hasLocation(#20001,#20024)
73-
#20025=@"module;{#10000},1,1"
74-
scopes(#20025,3)
75-
scopenodes(#20001,#20025)
76-
scopenesting(#20025,#20000)
77-
is_module(#20001)
78-
is_es2015_module(#20001)
79-
#20026=*
80-
entry_cfg_node(#20026,#20001)
81-
#20027=@"loc,{#10000},1,1,1,0"
82-
locations_default(#20027,#10000,1,1,1,0)
83-
hasLocation(#20026,#20027)
84-
#20028=*
85-
exit_cfg_node(#20028,#20001)
86-
hasLocation(#20028,#20023)
87-
successor(#20026,#20028)
73+
#20025=*
74+
entry_cfg_node(#20025,#20001)
75+
#20026=@"loc,{#10000},1,1,1,0"
76+
locations_default(#20026,#10000,1,1,1,0)
77+
hasLocation(#20025,#20026)
78+
#20027=*
79+
exit_cfg_node(#20027,#20001)
80+
hasLocation(#20027,#20023)
81+
successor(#20025,#20027)
8882
numlines(#10000,1,1,0)
8983
filetype(#10000,"javascript")

javascript/extractor/tests/flow/output/trap/importTypeInDeclaredModule.js.trap

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -205,20 +205,14 @@ toplevels(#20001,0)
205205
#20071=@"loc,{#10000},1,1,11,2"
206206
locations_default(#20071,#10000,1,1,11,2)
207207
hasLocation(#20001,#20071)
208-
#20072=@"module;{#10000},1,1"
209-
scopes(#20072,3)
210-
scopenodes(#20001,#20072)
211-
scopenesting(#20072,#20000)
212-
is_module(#20001)
213-
is_es2015_module(#20001)
214-
#20073=*
215-
entry_cfg_node(#20073,#20001)
216-
#20074=@"loc,{#10000},1,1,1,0"
217-
locations_default(#20074,#10000,1,1,1,0)
218-
hasLocation(#20073,#20074)
219-
#20075=*
220-
exit_cfg_node(#20075,#20001)
221-
hasLocation(#20075,#20070)
222-
successor(#20073,#20075)
208+
#20072=*
209+
entry_cfg_node(#20072,#20001)
210+
#20073=@"loc,{#10000},1,1,1,0"
211+
locations_default(#20073,#10000,1,1,1,0)
212+
hasLocation(#20072,#20073)
213+
#20074=*
214+
exit_cfg_node(#20074,#20001)
215+
hasLocation(#20074,#20070)
216+
successor(#20072,#20074)
223217
numlines(#10000,11,10,0)
224218
filetype(#10000,"javascript")

javascript/extractor/tests/flow/output/trap/variance.js.trap

Lines changed: 76 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -160,95 +160,89 @@ toplevels(#20001,0)
160160
#20057=@"loc,{#10000},1,1,7,1"
161161
locations_default(#20057,#10000,1,1,7,1)
162162
hasLocation(#20001,#20057)
163-
#20058=@"module;{#10000},1,1"
164-
scopes(#20058,3)
165-
scopenodes(#20001,#20058)
166-
scopenesting(#20058,#20000)
167-
is_module(#20001)
168-
is_es2015_module(#20001)
169-
#20059=@"var;{Foo};{#20058}"
170-
variables(#20059,"Foo",#20058)
171-
#20060=@"local_type_name;{Foo};{#20058}"
172-
local_type_names(#20060,"Foo",#20058)
173-
#20061=*
174-
stmts(#20061,26,#20001,0,"class F ... : int\n}")
175-
#20062=@"loc,{#10000},5,1,7,1"
176-
locations_default(#20062,#10000,5,1,7,1)
177-
hasLocation(#20061,#20062)
178-
stmt_containers(#20061,#20001)
163+
#20058=@"var;{Foo};{#20000}"
164+
variables(#20058,"Foo",#20000)
165+
#20059=@"local_type_name;{Foo};{#20000}"
166+
local_type_names(#20059,"Foo",#20000)
167+
#20060=*
168+
stmts(#20060,26,#20001,0,"class F ... : int\n}")
169+
#20061=@"loc,{#10000},5,1,7,1"
170+
locations_default(#20061,#10000,5,1,7,1)
171+
hasLocation(#20060,#20061)
172+
stmt_containers(#20060,#20001)
173+
#20062=*
174+
exprs(#20062,78,#20060,0,"Foo")
175+
hasLocation(#20062,#20043)
176+
enclosing_stmt(#20062,#20060)
177+
expr_containers(#20062,#20001)
178+
literals("Foo","Foo",#20062)
179+
decl(#20062,#20058)
180+
typedecl(#20062,#20059)
179181
#20063=*
180-
exprs(#20063,78,#20061,0,"Foo")
181-
hasLocation(#20063,#20043)
182-
enclosing_stmt(#20063,#20061)
183-
expr_containers(#20063,#20001)
184-
literals("Foo","Foo",#20063)
185-
decl(#20063,#20059)
186-
typedecl(#20063,#20060)
182+
scopes(#20063,10)
183+
scopenodes(#20060,#20063)
184+
scopenesting(#20063,#20000)
187185
#20064=*
188-
scopes(#20064,10)
189-
scopenodes(#20061,#20064)
190-
scopenesting(#20064,#20058)
191-
#20065=*
192-
properties(#20065,#20061,2,8,"+x: int")
193-
#20066=@"loc,{#10000},6,3,6,9"
194-
locations_default(#20066,#10000,6,3,6,9)
195-
hasLocation(#20065,#20066)
186+
properties(#20064,#20060,2,8,"+x: int")
187+
#20065=@"loc,{#10000},6,3,6,9"
188+
locations_default(#20065,#10000,6,3,6,9)
189+
hasLocation(#20064,#20065)
190+
#20066=*
196191
#20067=*
192+
exprs(#20067,0,#20064,0,"x")
193+
hasLocation(#20067,#20049)
194+
expr_containers(#20067,#20066)
195+
literals("x","x",#20067)
197196
#20068=*
198-
exprs(#20068,0,#20065,0,"x")
199-
hasLocation(#20068,#20049)
200-
expr_containers(#20068,#20067)
201-
literals("x","x",#20068)
202-
#20069=*
203-
properties(#20069,#20061,3,0,"constructor() {}")
204-
#20070=@"loc,{#10000},5,11,5,10"
205-
locations_default(#20070,#10000,5,11,5,10)
206-
hasLocation(#20069,#20070)
197+
properties(#20068,#20060,3,0,"constructor() {}")
198+
#20069=@"loc,{#10000},5,11,5,10"
199+
locations_default(#20069,#10000,5,11,5,10)
200+
hasLocation(#20068,#20069)
201+
#20070=*
202+
exprs(#20070,0,#20068,0,"constructor")
203+
hasLocation(#20070,#20069)
204+
enclosing_stmt(#20070,#20060)
205+
expr_containers(#20070,#20001)
206+
literals("constructor","constructor",#20070)
207+
exprs(#20066,9,#20068,1,"() {}")
208+
hasLocation(#20066,#20069)
209+
enclosing_stmt(#20066,#20060)
210+
expr_containers(#20066,#20001)
207211
#20071=*
208-
exprs(#20071,0,#20069,0,"constructor")
209-
hasLocation(#20071,#20070)
210-
enclosing_stmt(#20071,#20061)
211-
expr_containers(#20071,#20001)
212-
literals("constructor","constructor",#20071)
213-
exprs(#20067,9,#20069,1,"() {}")
214-
hasLocation(#20067,#20070)
215-
enclosing_stmt(#20067,#20061)
216-
expr_containers(#20067,#20001)
217-
#20072=*
218-
scopes(#20072,1)
219-
scopenodes(#20067,#20072)
220-
scopenesting(#20072,#20064)
221-
#20073=@"var;{arguments};{#20072}"
222-
variables(#20073,"arguments",#20072)
223-
is_arguments_object(#20073)
212+
scopes(#20071,1)
213+
scopenodes(#20066,#20071)
214+
scopenesting(#20071,#20063)
215+
#20072=@"var;{arguments};{#20071}"
216+
variables(#20072,"arguments",#20071)
217+
is_arguments_object(#20072)
218+
#20073=*
219+
stmts(#20073,1,#20066,-2,"{}")
220+
hasLocation(#20073,#20069)
221+
stmt_containers(#20073,#20066)
222+
is_method(#20068)
224223
#20074=*
225-
stmts(#20074,1,#20067,-2,"{}")
226-
hasLocation(#20074,#20070)
227-
stmt_containers(#20074,#20067)
228-
is_method(#20069)
229-
#20075=*
230-
entry_cfg_node(#20075,#20001)
231-
#20076=@"loc,{#10000},1,1,1,0"
232-
locations_default(#20076,#10000,1,1,1,0)
233-
hasLocation(#20075,#20076)
224+
entry_cfg_node(#20074,#20001)
225+
#20075=@"loc,{#10000},1,1,1,0"
226+
locations_default(#20075,#10000,1,1,1,0)
227+
hasLocation(#20074,#20075)
228+
#20076=*
229+
exit_cfg_node(#20076,#20001)
230+
hasLocation(#20076,#20056)
231+
successor(#20067,#20064)
232+
successor(#20066,#20068)
234233
#20077=*
235-
exit_cfg_node(#20077,#20001)
236-
hasLocation(#20077,#20056)
237-
successor(#20068,#20065)
238-
successor(#20067,#20069)
234+
entry_cfg_node(#20077,#20066)
235+
hasLocation(#20077,#20069)
236+
successor(#20064,#20073)
239237
#20078=*
240-
entry_cfg_node(#20078,#20067)
241-
hasLocation(#20078,#20070)
242-
successor(#20065,#20074)
243-
#20079=*
244-
exit_cfg_node(#20079,#20067)
245-
hasLocation(#20079,#20070)
246-
successor(#20074,#20079)
247-
successor(#20078,#20068)
248-
successor(#20071,#20067)
249-
successor(#20069,#20061)
250-
successor(#20063,#20071)
251-
successor(#20061,#20077)
252-
successor(#20075,#20063)
238+
exit_cfg_node(#20078,#20066)
239+
hasLocation(#20078,#20069)
240+
successor(#20073,#20078)
241+
successor(#20077,#20067)
242+
successor(#20070,#20066)
243+
successor(#20068,#20060)
244+
successor(#20062,#20070)
245+
successor(#20060,#20076)
246+
successor(#20074,#20062)
253247
numlines(#10000,7,6,0)
254248
filetype(#10000,"javascript")

0 commit comments

Comments
 (0)