Relax import assertion key-is-type constraint (#13409)

This commit is contained in:
Huáng Jùnliàng
2021-06-02 07:51:56 -04:00
committed by GitHub
parent b281fe352c
commit b8175ec060
13 changed files with 83 additions and 52 deletions

View File

@@ -0,0 +1,2 @@
import "foo"
assert { type: "json" }

View File

@@ -0,0 +1,69 @@
{
"type": "File",
"start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":23}},
"errors": [
"SyntaxError: Missing semicolon. (2:6)"
],
"program": {
"type": "Program",
"start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":23}},
"sourceType": "module",
"interpreter": null,
"body": [
{
"type": "ImportDeclaration",
"start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}},
"specifiers": [],
"source": {
"type": "StringLiteral",
"start":7,"end":12,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":12}},
"extra": {
"rawValue": "foo",
"raw": "\"foo\""
},
"value": "foo"
},
"assertions": []
},
{
"type": "ExpressionStatement",
"start":13,"end":19,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":6}},
"expression": {
"type": "Identifier",
"start":13,"end":19,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":6},"identifierName":"assert"},
"name": "assert"
}
},
{
"type": "BlockStatement",
"start":20,"end":36,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":23}},
"body": [
{
"type": "LabeledStatement",
"start":22,"end":34,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":21}},
"body": {
"type": "ExpressionStatement",
"start":28,"end":34,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":21}},
"expression": {
"type": "StringLiteral",
"start":28,"end":34,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":21}},
"extra": {
"rawValue": "json",
"raw": "\"json\""
},
"value": "json"
}
},
"label": {
"type": "Identifier",
"start":22,"end":26,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":13},"identifierName":"type"},
"name": "type"
}
}
],
"directives": []
}
],
"directives": []
}
}

View File

@@ -1,10 +1,6 @@
{
"type": "File",
"start":0,"end":101,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":52}},
"errors": [
"SyntaxError: The only accepted module attribute is `type`. (1:36)",
"SyntaxError: The only accepted module attribute is `type`. (2:40)"
],
"program": {
"type": "Program",
"start":0,"end":101,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":52}},

View File

@@ -1,9 +1,6 @@
{
"type": "File",
"start":0,"end":55,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":55}},
"errors": [
"SyntaxError: The only accepted module attribute is `type`. (1:40)"
],
"program": {
"type": "Program",
"start":0,"end":55,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":55}},

View File

@@ -1,9 +1,6 @@
{
"type": "File",
"start":0,"end":79,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":79}},
"errors": [
"SyntaxError: The only accepted module attribute is `type`. (1:54)"
],
"program": {
"type": "Program",
"start":0,"end":79,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":79}},

View File

@@ -1,9 +1,6 @@
{
"type": "File",
"start":0,"end":51,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":51}},
"errors": [
"SyntaxError: The only accepted module attribute is `type`. (1:36)"
],
"program": {
"type": "Program",
"start":0,"end":51,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":51}},

View File

@@ -1,9 +1,6 @@
{
"type": "File",
"start":0,"end":75,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":75}},
"errors": [
"SyntaxError: The only accepted module attribute is `type`. (1:50)"
],
"program": {
"type": "Program",
"start":0,"end":75,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":75}},