fix: update UnexpectedPrivateField error message (#13975)

This commit is contained in:
Huáng Jùnliàng 2021-11-17 12:54:23 -05:00 committed by GitHub
parent 6e2222756d
commit d30308fe8e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 11 additions and 12 deletions

View File

@ -213,8 +213,7 @@ export const ErrorMessages = makeErrorTemplates(
"`new.target` can only be used in functions or class properties.", "`new.target` can only be used in functions or class properties.",
UnexpectedNumericSeparator: UnexpectedNumericSeparator:
"A numeric separator is only allowed between two digits.", "A numeric separator is only allowed between two digits.",
UnexpectedPrivateField: UnexpectedPrivateField: "Unexpected private name.",
"Private names can only be used as the name of a class element (i.e. class C { #p = 42; #m() {} } )\n or a property of member expression (i.e. this.#p).",
UnexpectedReservedWord: "Unexpected reserved word '%0'.", UnexpectedReservedWord: "Unexpected reserved word '%0'.",
UnexpectedSuper: "'super' is only allowed in object methods and classes.", UnexpectedSuper: "'super' is only allowed in object methods and classes.",
UnexpectedToken: "Unexpected token '%0'.", UnexpectedToken: "Unexpected token '%0'.",

View File

@ -2,7 +2,7 @@
"type": "File", "type": "File",
"start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}},
"errors": [ "errors": [
"SyntaxError: Private names can only be used as the name of a class element (i.e. class C { #p = 42; #m() {} } )\n or a property of member expression (i.e. this.#p). (3:11)" "SyntaxError: Unexpected private name. (3:11)"
], ],
"program": { "program": {
"type": "Program", "type": "Program",
@ -107,4 +107,4 @@
], ],
"directives": [] "directives": []
} }
} }

View File

@ -2,7 +2,7 @@
"type": "File", "type": "File",
"start":0,"end":59,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, "start":0,"end":59,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}},
"errors": [ "errors": [
"SyntaxError: Private names can only be used as the name of a class element (i.e. class C { #p = 42; #m() {} } )\n or a property of member expression (i.e. this.#p). (4:12)" "SyntaxError: Unexpected private name. (4:12)"
], ],
"program": { "program": {
"type": "Program", "type": "Program",
@ -116,4 +116,4 @@
], ],
"directives": [] "directives": []
} }
} }

View File

@ -2,7 +2,7 @@
"type": "File", "type": "File",
"start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}},
"errors": [ "errors": [
"SyntaxError: Private names can only be used as the name of a class element (i.e. class C { #p = 42; #m() {} } )\n or a property of member expression (i.e. this.#p). (2:11)" "SyntaxError: Unexpected private name. (2:11)"
], ],
"program": { "program": {
"type": "Program", "type": "Program",
@ -78,4 +78,4 @@
], ],
"directives": [] "directives": []
} }
} }

View File

@ -2,7 +2,7 @@
"type": "File", "type": "File",
"start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}},
"errors": [ "errors": [
"SyntaxError: Private names can only be used as the name of a class element (i.e. class C { #p = 42; #m() {} } )\n or a property of member expression (i.e. this.#p). (2:11)" "SyntaxError: Unexpected private name. (2:11)"
], ],
"program": { "program": {
"type": "Program", "type": "Program",
@ -77,4 +77,4 @@
], ],
"directives": [] "directives": []
} }
} }

View File

@ -2,7 +2,7 @@
"type": "File", "type": "File",
"start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}},
"errors": [ "errors": [
"SyntaxError: Private names can only be used as the name of a class element (i.e. class C { #p = 42; #m() {} } )\n or a property of member expression (i.e. this.#p). (2:3)" "SyntaxError: Unexpected private name. (2:3)"
], ],
"program": { "program": {
"type": "Program", "type": "Program",
@ -49,4 +49,4 @@
], ],
"directives": [] "directives": []
} }
} }