Skip to content

Commit e648477

Browse files
authored
Merge pull request #1114 from xiemaisi/js/yield-import
Approved by asger-semmle
2 parents 0471471 + 03a2204 commit e648477

File tree

4 files changed

+182
-2
lines changed

4 files changed

+182
-2
lines changed

javascript/extractor/src/com/semmle/jcorn/TokenType.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ public void updateContext(Parser parser, TokenType prevType) {
183183
_class = new TokenType(kw("class")),
184184
_extends = new TokenType(kw("extends").beforeExpr()),
185185
_export = new TokenType(kw("export")),
186-
_import = new TokenType(kw("import")),
186+
_import = new TokenType(kw("import").startsExpr()),
187187
_null = new TokenType(kw("null").startsExpr()),
188188
_true = new TokenType(kw("true").startsExpr()),
189189
_false = new TokenType(kw("false").startsExpr()),

javascript/extractor/src/com/semmle/js/extractor/Main.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public class Main {
3737
* A version identifier that should be updated every time the extractor changes in such a way that
3838
* it may produce different tuples for the same file under the same {@link ExtractorConfig}.
3939
*/
40-
public static final String EXTRACTOR_VERSION = "2019-03-11";
40+
public static final String EXTRACTOR_VERSION = "2019-03-13";
4141

4242
public static final Pattern NEWLINE = Pattern.compile("\n");
4343

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
function* f() {
2+
yield import("foo")
3+
}
Lines changed: 177 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
1+
#10000=@"/yield-import.js;sourcefile"
2+
files(#10000,"/yield-import.js","yield-import","js",0)
3+
#10001=@"/;folder"
4+
folders(#10001,"/","")
5+
containerparent(#10001,#10000)
6+
#10002=@"loc,{#10000},0,0,0,0"
7+
locations_default(#10002,#10000,0,0,0,0)
8+
hasLocation(#10000,#10002)
9+
#20000=@"global_scope"
10+
scopes(#20000,0)
11+
#20001=@"script;{#10000},1,1"
12+
#20002=*
13+
lines(#20002,#20001,"function* f() {","
14+
")
15+
#20003=@"loc,{#10000},1,1,1,15"
16+
locations_default(#20003,#10000,1,1,1,15)
17+
hasLocation(#20002,#20003)
18+
#20004=*
19+
lines(#20004,#20001," yield import(""foo"")","
20+
")
21+
#20005=@"loc,{#10000},2,1,2,21"
22+
locations_default(#20005,#10000,2,1,2,21)
23+
hasLocation(#20004,#20005)
24+
indentation(#10000,2," ",2)
25+
#20006=*
26+
lines(#20006,#20001,"}","
27+
")
28+
#20007=@"loc,{#10000},3,1,3,1"
29+
locations_default(#20007,#10000,3,1,3,1)
30+
hasLocation(#20006,#20007)
31+
numlines(#20001,3,3,0)
32+
#20008=*
33+
tokeninfo(#20008,7,#20001,0,"function")
34+
#20009=@"loc,{#10000},1,1,1,8"
35+
locations_default(#20009,#10000,1,1,1,8)
36+
hasLocation(#20008,#20009)
37+
#20010=*
38+
tokeninfo(#20010,8,#20001,1,"*")
39+
#20011=@"loc,{#10000},1,9,1,9"
40+
locations_default(#20011,#10000,1,9,1,9)
41+
hasLocation(#20010,#20011)
42+
#20012=*
43+
tokeninfo(#20012,6,#20001,2,"f")
44+
#20013=@"loc,{#10000},1,11,1,11"
45+
locations_default(#20013,#10000,1,11,1,11)
46+
hasLocation(#20012,#20013)
47+
#20014=*
48+
tokeninfo(#20014,8,#20001,3,"(")
49+
#20015=@"loc,{#10000},1,12,1,12"
50+
locations_default(#20015,#10000,1,12,1,12)
51+
hasLocation(#20014,#20015)
52+
#20016=*
53+
tokeninfo(#20016,8,#20001,4,")")
54+
#20017=@"loc,{#10000},1,13,1,13"
55+
locations_default(#20017,#10000,1,13,1,13)
56+
hasLocation(#20016,#20017)
57+
#20018=*
58+
tokeninfo(#20018,8,#20001,5,"{")
59+
#20019=@"loc,{#10000},1,15,1,15"
60+
locations_default(#20019,#10000,1,15,1,15)
61+
hasLocation(#20018,#20019)
62+
#20020=*
63+
tokeninfo(#20020,7,#20001,6,"yield")
64+
#20021=@"loc,{#10000},2,3,2,7"
65+
locations_default(#20021,#10000,2,3,2,7)
66+
hasLocation(#20020,#20021)
67+
#20022=*
68+
tokeninfo(#20022,7,#20001,7,"import")
69+
#20023=@"loc,{#10000},2,9,2,14"
70+
locations_default(#20023,#10000,2,9,2,14)
71+
hasLocation(#20022,#20023)
72+
#20024=*
73+
tokeninfo(#20024,8,#20001,8,"(")
74+
#20025=@"loc,{#10000},2,15,2,15"
75+
locations_default(#20025,#10000,2,15,2,15)
76+
hasLocation(#20024,#20025)
77+
#20026=*
78+
tokeninfo(#20026,4,#20001,9,"""foo""")
79+
#20027=@"loc,{#10000},2,16,2,20"
80+
locations_default(#20027,#10000,2,16,2,20)
81+
hasLocation(#20026,#20027)
82+
#20028=*
83+
tokeninfo(#20028,8,#20001,10,")")
84+
#20029=@"loc,{#10000},2,21,2,21"
85+
locations_default(#20029,#10000,2,21,2,21)
86+
hasLocation(#20028,#20029)
87+
#20030=*
88+
tokeninfo(#20030,8,#20001,11,"}")
89+
hasLocation(#20030,#20007)
90+
#20031=*
91+
tokeninfo(#20031,0,#20001,12,"")
92+
#20032=@"loc,{#10000},4,1,4,0"
93+
locations_default(#20032,#10000,4,1,4,0)
94+
hasLocation(#20031,#20032)
95+
toplevels(#20001,0)
96+
#20033=@"loc,{#10000},1,1,4,0"
97+
locations_default(#20033,#10000,1,1,4,0)
98+
hasLocation(#20001,#20033)
99+
#20034=@"var;{f};{#20000}"
100+
variables(#20034,"f",#20000)
101+
#20035=*
102+
stmts(#20035,17,#20001,0,"functio ... foo"")\n}")
103+
#20036=@"loc,{#10000},1,1,3,1"
104+
locations_default(#20036,#10000,1,1,3,1)
105+
hasLocation(#20035,#20036)
106+
stmtContainers(#20035,#20001)
107+
#20037=*
108+
exprs(#20037,78,#20035,-1,"f")
109+
hasLocation(#20037,#20013)
110+
exprContainers(#20037,#20035)
111+
literals("f","f",#20037)
112+
decl(#20037,#20034)
113+
#20038=*
114+
scopes(#20038,1)
115+
scopenodes(#20035,#20038)
116+
scopenesting(#20038,#20000)
117+
#20039=@"var;{arguments};{#20038}"
118+
variables(#20039,"arguments",#20038)
119+
isArgumentsObject(#20039)
120+
isGenerator(#20035)
121+
#20040=*
122+
stmts(#20040,1,#20035,-2,"{\n yie ... foo"")\n}")
123+
#20041=@"loc,{#10000},1,15,3,1"
124+
locations_default(#20041,#10000,1,15,3,1)
125+
hasLocation(#20040,#20041)
126+
stmtContainers(#20040,#20035)
127+
#20042=*
128+
stmts(#20042,2,#20040,0,"yield import(""foo"")")
129+
#20043=@"loc,{#10000},2,3,2,21"
130+
locations_default(#20043,#10000,2,3,2,21)
131+
hasLocation(#20042,#20043)
132+
stmtContainers(#20042,#20035)
133+
#20044=*
134+
exprs(#20044,69,#20042,0,"yield import(""foo"")")
135+
hasLocation(#20044,#20043)
136+
enclosingStmt(#20044,#20042)
137+
exprContainers(#20044,#20035)
138+
#20045=*
139+
exprs(#20045,99,#20044,0,"import(""foo"")")
140+
#20046=@"loc,{#10000},2,9,2,21"
141+
locations_default(#20046,#10000,2,9,2,21)
142+
hasLocation(#20045,#20046)
143+
enclosingStmt(#20045,#20042)
144+
exprContainers(#20045,#20035)
145+
#20047=*
146+
exprs(#20047,4,#20045,0,"""foo""")
147+
hasLocation(#20047,#20027)
148+
enclosingStmt(#20047,#20042)
149+
exprContainers(#20047,#20035)
150+
literals("foo","""foo""",#20047)
151+
#20048=*
152+
entry_cfg_node(#20048,#20001)
153+
#20049=@"loc,{#10000},1,1,1,0"
154+
locations_default(#20049,#10000,1,1,1,0)
155+
hasLocation(#20048,#20049)
156+
#20050=*
157+
exit_cfg_node(#20050,#20001)
158+
hasLocation(#20050,#20032)
159+
successor(#20035,#20050)
160+
#20051=*
161+
entry_cfg_node(#20051,#20035)
162+
hasLocation(#20051,#20049)
163+
#20052=*
164+
exit_cfg_node(#20052,#20035)
165+
#20053=@"loc,{#10000},3,2,3,1"
166+
locations_default(#20053,#10000,3,2,3,1)
167+
hasLocation(#20052,#20053)
168+
successor(#20040,#20042)
169+
successor(#20042,#20047)
170+
successor(#20047,#20045)
171+
successor(#20045,#20044)
172+
successor(#20044,#20052)
173+
successor(#20051,#20040)
174+
successor(#20037,#20035)
175+
successor(#20048,#20037)
176+
numlines(#10000,3,3,0)
177+
filetype(#10000,"javascript")

0 commit comments

Comments
 (0)