Skip to content

Commit eb13dad

Browse files
committed
Merge branch 'bugfix/966_object-literal-reserved-keywords'
2 parents 77cf3fd + 0a32f15 commit eb13dad

3 files changed

Lines changed: 46 additions & 8 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
[Read translated version (en)](./translations/en/CHANGELOG.md)
22

3+
# 1.1.1
4+
5+
- Fix: オブジェクトリテラルのプロパティ名に一部の予約語を記述できなかった問題を修正
6+
37
# 1.1.0
48

59
- オブジェクトリテラルのプロパティ名に予約語を直接記述できるようになりました。

src/parser/plugins/validate-keyword.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -149,14 +149,6 @@ function validateNode(node: Ast.Node): Ast.Node {
149149
}
150150
break;
151151
}
152-
case 'obj': {
153-
for (const name of node.value.keys()) {
154-
if (reservedWord.includes(name)) {
155-
throwReservedWordError(name, node.loc);
156-
}
157-
}
158-
break;
159-
}
160152
case 'namedTypeSource': {
161153
if (reservedWord.includes(node.name)) {
162154
throwReservedWordError(node.name, node.loc);

test/literals.ts

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,48 @@ describe('literal', () => {
189189
['var'],
190190
['let'],
191191
['exists'],
192+
193+
// unused keywords
194+
['as'],
195+
['async'],
196+
['attr'],
197+
['attribute'],
198+
['await'],
199+
['catch'],
200+
['class'],
201+
['component'],
202+
['constructor'],
203+
['dictionary'],
204+
['enum'],
205+
['export'],
206+
['finally'],
207+
['fn'],
208+
['hash'],
209+
['in'],
210+
['interface'],
211+
['out'],
212+
['private'],
213+
['public'],
214+
['ref'],
215+
['static'],
216+
['struct'],
217+
['table'],
218+
['this'],
219+
['throw'],
220+
['trait'],
221+
['try'],
222+
['undefined'],
223+
['use'],
224+
['using'],
225+
['when'],
226+
['while'],
227+
['yield'],
228+
['import'],
229+
['is'],
230+
['meta'],
231+
['module'],
232+
['namespace'],
233+
['new']
192234
])('key "%s"', async (key) => {
193235
const res = await exe(`
194236
<: {

0 commit comments

Comments
 (0)