parser: Fix Hack/smart-pipe error positions (#13426)

This commit is contained in:
J. S. Choi
2021-06-07 10:09:12 -04:00
committed by Nicolò Ribaudo
parent 6276853eb9
commit cd4b3fbffe
16 changed files with 19 additions and 19 deletions

View File

@@ -1264,7 +1264,7 @@ export default class ExpressionParser extends LValParser {
if (pipeProposal) {
// A pipe-operator proposal is active.
const tokenType = this.state.type;
const { type: tokenType, start } = this.state;
if (this.testTopicReferenceConfiguration(pipeProposal, tokenType)) {
// The token matches the plugins configuration.
@@ -1295,10 +1295,10 @@ export default class ExpressionParser extends LValParser {
// it is outside of a pipe body.
// Raise recoverable errors.
if (pipeProposal === "smart") {
this.raise(this.state.start, Errors.PrimaryTopicNotAllowed);
this.raise(start, Errors.PrimaryTopicNotAllowed);
} else {
// In this case, `pipeProposal === "hack"` is true.
this.raise(this.state.start, Errors.PipeTopicUnbound);
this.raise(start, Errors.PipeTopicUnbound);
}
}
@@ -1306,7 +1306,7 @@ export default class ExpressionParser extends LValParser {
} else {
// The token does not match the plugins configuration.
throw this.raise(
this.state.start,
start,
Errors.PipeTopicUnconfiguredToken,
tokenType.label,
);