Fix error message for #4 case
This impact private fields as well as smart pipeline, providing a clearer error message for both.
This commit is contained in:
parent
ba5642d4ee
commit
25d01460fd
@ -412,6 +412,10 @@ export default class Tokenizer extends LocationParser {
|
||||
|
||||
const nextPos = this.state.pos + 1;
|
||||
const next = this.input.charCodeAt(nextPos);
|
||||
if (next >= charCodes.digit0 && next <= charCodes.digit9) {
|
||||
this.raise(this.state.pos, "Unexpected digit after hash token");
|
||||
}
|
||||
|
||||
if (
|
||||
(this.hasPlugin("classPrivateProperties") ||
|
||||
this.hasPlugin("classPrivateMethods")) &&
|
||||
@ -423,16 +427,7 @@ export default class Tokenizer extends LocationParser {
|
||||
} else if (
|
||||
this.getPluginOption("pipelineOperator", "proposal") === "smart"
|
||||
) {
|
||||
if (next >= charCodes.digit0 && next <= charCodes.digit9) {
|
||||
this.raise(
|
||||
this.state.pos,
|
||||
`Unexpected digit after topic reference: '#${String.fromCodePoint(
|
||||
next,
|
||||
)}'`,
|
||||
);
|
||||
} else {
|
||||
this.finishOp(tt.hash, 1);
|
||||
}
|
||||
} else {
|
||||
this.raise(
|
||||
this.state.pos,
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
{
|
||||
"throws": "Unexpected token (2:3)",
|
||||
"throws": "Unexpected digit after hash token (2:2)",
|
||||
"plugins": [ "classPrivateProperties" ]
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
{
|
||||
"throws": "Identifier directly after number (2:4)",
|
||||
"throws": "Unexpected digit after hash token (2:2)",
|
||||
"plugins": ["classPrivateProperties"]
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
{
|
||||
"plugins": [["pipelineOperator", { "proposal": "smart" }]],
|
||||
"throws": "Unexpected digit after topic reference: '#4' (1:5)"
|
||||
"throws": "Unexpected digit after hash token (1:5)"
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user