Skip to content

Commit 2dcb76d

Browse files
committed
Merge pull request #111 from eslint/issue110
Fix: Tagged template strings should parse (fixes #110)
2 parents 2d91bb6 + b6301f9 commit 2dcb76d

File tree

3 files changed

+116
-1
lines changed

3 files changed

+116
-1
lines changed

espree.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2998,7 +2998,7 @@ function parseLeftHandSideExpressionAllowCall() {
29982998
expr = markerApply(marker, astNodeFactory.createMemberExpression("[", expr, parseComputedMember()));
29992999
} else if (match(".")) {
30003000
expr = markerApply(marker, astNodeFactory.createMemberExpression(".", expr, parseNonComputedMember()));
3001-
} else if (!lookahead.tail) {
3001+
} else {
30023002
expr = markerApply(marker, astNodeFactory.createTaggedTemplateExpression(expr, parseTemplateLiteral()));
30033003
}
30043004
}
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
module.exports = {
2+
"type": "Program",
3+
"body": [
4+
{
5+
"type": "ExpressionStatement",
6+
"expression": {
7+
"type": "TaggedTemplateExpression",
8+
"tag": {
9+
"type": "Identifier",
10+
"name": "foo",
11+
"range": [
12+
0,
13+
3
14+
],
15+
"loc": {
16+
"start": {
17+
"line": 1,
18+
"column": 0
19+
},
20+
"end": {
21+
"line": 1,
22+
"column": 3
23+
}
24+
}
25+
},
26+
"quasi": {
27+
"type": "TemplateLiteral",
28+
"quasis": [
29+
{
30+
"type": "TemplateElement",
31+
"value": {
32+
"raw": "foo",
33+
"cooked": "foo"
34+
},
35+
"tail": true,
36+
"range": [
37+
3,
38+
8
39+
],
40+
"loc": {
41+
"start": {
42+
"line": 1,
43+
"column": 3
44+
},
45+
"end": {
46+
"line": 1,
47+
"column": 8
48+
}
49+
}
50+
}
51+
],
52+
"expressions": [],
53+
"range": [
54+
3,
55+
8
56+
],
57+
"loc": {
58+
"start": {
59+
"line": 1,
60+
"column": 3
61+
},
62+
"end": {
63+
"line": 1,
64+
"column": 8
65+
}
66+
}
67+
},
68+
"range": [
69+
0,
70+
8
71+
],
72+
"loc": {
73+
"start": {
74+
"line": 1,
75+
"column": 0
76+
},
77+
"end": {
78+
"line": 1,
79+
"column": 8
80+
}
81+
}
82+
},
83+
"range": [
84+
0,
85+
9
86+
],
87+
"loc": {
88+
"start": {
89+
"line": 1,
90+
"column": 0
91+
},
92+
"end": {
93+
"line": 1,
94+
"column": 9
95+
}
96+
}
97+
}
98+
],
99+
"sourceType": "script",
100+
"range": [
101+
0,
102+
9
103+
],
104+
"loc": {
105+
"start": {
106+
"line": 1,
107+
"column": 0
108+
},
109+
"end": {
110+
"line": 1,
111+
"column": 9
112+
}
113+
}
114+
};
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
foo`foo`;

0 commit comments

Comments
 (0)