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 nextPos = this.state.pos + 1;
|
||||||
const next = this.input.charCodeAt(nextPos);
|
const next = this.input.charCodeAt(nextPos);
|
||||||
|
if (next >= charCodes.digit0 && next <= charCodes.digit9) {
|
||||||
|
this.raise(this.state.pos, "Unexpected digit after hash token");
|
||||||
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
(this.hasPlugin("classPrivateProperties") ||
|
(this.hasPlugin("classPrivateProperties") ||
|
||||||
this.hasPlugin("classPrivateMethods")) &&
|
this.hasPlugin("classPrivateMethods")) &&
|
||||||
@ -423,16 +427,7 @@ export default class Tokenizer extends LocationParser {
|
|||||||
} else if (
|
} else if (
|
||||||
this.getPluginOption("pipelineOperator", "proposal") === "smart"
|
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);
|
this.finishOp(tt.hash, 1);
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
this.raise(
|
this.raise(
|
||||||
this.state.pos,
|
this.state.pos,
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
{
|
{
|
||||||
"throws": "Unexpected token (2:3)",
|
"throws": "Unexpected digit after hash token (2:2)",
|
||||||
"plugins": [ "classPrivateProperties" ]
|
"plugins": [ "classPrivateProperties" ]
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
{
|
{
|
||||||
"throws": "Identifier directly after number (2:4)",
|
"throws": "Unexpected digit after hash token (2:2)",
|
||||||
"plugins": ["classPrivateProperties"]
|
"plugins": ["classPrivateProperties"]
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
{
|
{
|
||||||
"plugins": [["pipelineOperator", { "proposal": "smart" }]],
|
"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