Files
Huáng JùnliàngandGitHub 61bea4ddf5 Fix: always initialize ExportDeclaration attributes (#17164)
* chore: bump eslint and espree

* fix: always initialize ExportDeclaration attributes

* update AST fixtures

* fix: initialize attributes when importAssertions is not enabled

* update AST fixtures

* update test snapshot

* update Makefile.js

* update Babel 8 AST fixtures
2025-03-06 15:29:46 -05:00

179 lines
8.6 KiB
JSON

{
"type": "File",
"start":0,"end":94,"loc":{"start":{"line":1,"column":0,"index":0},"end":{"line":2,"column":67,"index":94}},
"errors": [
"SyntaxError: Identifier 'foo4' has already been declared. (2:49)",
"SyntaxError: `foo4` has already been exported. Exported identifiers must be unique. (2:49)"
],
"program": {
"type": "Program",
"start":0,"end":94,"loc":{"start":{"line":1,"column":0,"index":0},"end":{"line":2,"column":67,"index":94}},
"sourceType": "module",
"interpreter": null,
"body": [
{
"type": "ExportNamedDeclaration",
"start":0,"end":25,"loc":{"start":{"line":1,"column":0,"index":0},"end":{"line":1,"column":25,"index":25}},
"specifiers": [],
"source": null,
"attributes": [],
"declaration": {
"type": "FunctionDeclaration",
"start":7,"end":25,"loc":{"start":{"line":1,"column":7,"index":7},"end":{"line":1,"column":25,"index":25}},
"id": {
"type": "Identifier",
"start":16,"end":20,"loc":{"start":{"line":1,"column":16,"index":16},"end":{"line":1,"column":20,"index":20},"identifierName":"foo4"},
"name": "foo4"
},
"generator": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start":23,"end":25,"loc":{"start":{"line":1,"column":23,"index":23},"end":{"line":1,"column":25,"index":25}},
"body": [],
"directives": []
}
}
},
{
"type": "EmptyStatement",
"start":25,"end":26,"loc":{"start":{"line":1,"column":25,"index":25},"end":{"line":1,"column":26,"index":26}}
},
{
"type": "ExportNamedDeclaration",
"start":27,"end":94,"loc":{"start":{"line":2,"column":0,"index":27},"end":{"line":2,"column":67,"index":94}},
"specifiers": [],
"source": null,
"attributes": [],
"declaration": {
"type": "VariableDeclaration",
"start":34,"end":94,"loc":{"start":{"line":2,"column":7,"index":34},"end":{"line":2,"column":67,"index":94}},
"declarations": [
{
"type": "VariableDeclarator",
"start":40,"end":93,"loc":{"start":{"line":2,"column":13,"index":40},"end":{"line":2,"column":66,"index":93}},
"id": {
"type": "ObjectPattern",
"start":40,"end":87,"loc":{"start":{"line":2,"column":13,"index":40},"end":{"line":2,"column":60,"index":87}},
"properties": [
{
"type": "ObjectProperty",
"start":42,"end":54,"loc":{"start":{"line":2,"column":15,"index":42},"end":{"line":2,"column":27,"index":54}},
"key": {
"type": "Identifier",
"start":42,"end":43,"loc":{"start":{"line":2,"column":15,"index":42},"end":{"line":2,"column":16,"index":43},"identifierName":"a"},
"name": "a"
},
"computed": false,
"method": false,
"shorthand": false,
"value": {
"type": "ArrayPattern",
"start":45,"end":54,"loc":{"start":{"line":2,"column":18,"index":45},"end":{"line":2,"column":27,"index":54}},
"elements": [
{
"type": "ObjectPattern",
"start":46,"end":53,"loc":{"start":{"line":2,"column":19,"index":46},"end":{"line":2,"column":26,"index":53}},
"properties": [
{
"type": "ObjectProperty",
"start":48,"end":51,"loc":{"start":{"line":2,"column":21,"index":48},"end":{"line":2,"column":24,"index":51}},
"key": {
"type": "Identifier",
"start":48,"end":51,"loc":{"start":{"line":2,"column":21,"index":48},"end":{"line":2,"column":24,"index":51},"identifierName":"foo"},
"name": "foo"
},
"computed": false,
"method": false,
"shorthand": true,
"value": {
"type": "Identifier",
"start":48,"end":51,"loc":{"start":{"line":2,"column":21,"index":48},"end":{"line":2,"column":24,"index":51},"identifierName":"foo"},
"name": "foo"
}
}
]
}
]
}
},
{
"type": "ObjectProperty",
"start":56,"end":85,"loc":{"start":{"line":2,"column":29,"index":56},"end":{"line":2,"column":58,"index":85}},
"key": {
"type": "Identifier",
"start":56,"end":57,"loc":{"start":{"line":2,"column":29,"index":56},"end":{"line":2,"column":30,"index":57},"identifierName":"b"},
"name": "b"
},
"computed": false,
"method": false,
"shorthand": false,
"value": {
"type": "ObjectPattern",
"start":59,"end":85,"loc":{"start":{"line":2,"column":32,"index":59},"end":{"line":2,"column":58,"index":85}},
"properties": [
{
"type": "ObjectProperty",
"start":61,"end":83,"loc":{"start":{"line":2,"column":34,"index":61},"end":{"line":2,"column":56,"index":83}},
"key": {
"type": "Identifier",
"start":61,"end":65,"loc":{"start":{"line":2,"column":34,"index":61},"end":{"line":2,"column":38,"index":65},"identifierName":"foo2"},
"name": "foo2"
},
"computed": false,
"method": false,
"shorthand": false,
"value": {
"type": "ArrayPattern",
"start":67,"end":83,"loc":{"start":{"line":2,"column":40,"index":67},"end":{"line":2,"column":56,"index":83}},
"elements": [
{
"type": "ObjectPattern",
"start":68,"end":82,"loc":{"start":{"line":2,"column":41,"index":68},"end":{"line":2,"column":55,"index":82}},
"properties": [
{
"type": "ObjectProperty",
"start":70,"end":80,"loc":{"start":{"line":2,"column":43,"index":70},"end":{"line":2,"column":53,"index":80}},
"key": {
"type": "Identifier",
"start":70,"end":74,"loc":{"start":{"line":2,"column":43,"index":70},"end":{"line":2,"column":47,"index":74},"identifierName":"foo3"},
"name": "foo3"
},
"computed": false,
"method": false,
"shorthand": false,
"value": {
"type": "Identifier",
"start":76,"end":80,"loc":{"start":{"line":2,"column":49,"index":76},"end":{"line":2,"column":53,"index":80},"identifierName":"foo4"},
"name": "foo4"
}
}
]
}
]
}
}
]
}
}
]
},
"init": {
"type": "Identifier",
"start":90,"end":93,"loc":{"start":{"line":2,"column":63,"index":90},"end":{"line":2,"column":66,"index":93},"identifierName":"bar"},
"name": "bar"
}
}
],
"kind": "const"
}
}
],
"directives": [],
"extra": {
"topLevelAwait": false
}
}
}