parser: Fix Hack/smart-pipe error positions (#13426)
This commit is contained in:
parent
6276853eb9
commit
cd4b3fbffe
@ -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 plugin’s 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 plugin’s configuration.
|
||||
throw this.raise(
|
||||
this.state.start,
|
||||
start,
|
||||
Errors.PipeTopicUnconfiguredToken,
|
||||
tokenType.label,
|
||||
);
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
"type": "File",
|
||||
"start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}},
|
||||
"errors": [
|
||||
"SyntaxError: Topic reference is unbound; it must be inside a pipe body. (1:5)"
|
||||
"SyntaxError: Topic reference is unbound; it must be inside a pipe body. (1:4)"
|
||||
],
|
||||
"program": {
|
||||
"type": "Program",
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
"type": "File",
|
||||
"start":0,"end":130,"loc":{"start":{"line":1,"column":0},"end":{"line":9,"column":2}},
|
||||
"errors": [
|
||||
"SyntaxError: Topic reference was used in a lexical context without topic binding. (6:15)",
|
||||
"SyntaxError: Topic reference was used in a lexical context without topic binding. (6:13)",
|
||||
"SyntaxError: Pipeline is in topic style but does not use topic reference. (1:9)"
|
||||
],
|
||||
"program": {
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
"type": "File",
|
||||
"start":0,"end":94,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":3}},
|
||||
"errors": [
|
||||
"SyntaxError: Topic reference was used in a lexical context without topic binding. (5:13)",
|
||||
"SyntaxError: Topic reference was used in a lexical context without topic binding. (5:11)",
|
||||
"SyntaxError: Pipeline is in topic style but does not use topic reference. (1:9)"
|
||||
],
|
||||
"program": {
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
"type": "File",
|
||||
"start":0,"end":45,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":45}},
|
||||
"errors": [
|
||||
"SyntaxError: Topic reference was used in a lexical context without topic binding. (1:40)",
|
||||
"SyntaxError: Topic reference was used in a lexical context without topic binding. (1:39)",
|
||||
"SyntaxError: Pipeline is in topic style but does not use topic reference. (1:5)"
|
||||
],
|
||||
"program": {
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
"type": "File",
|
||||
"start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":42}},
|
||||
"errors": [
|
||||
"SyntaxError: Topic reference was used in a lexical context without topic binding. (1:23)",
|
||||
"SyntaxError: Topic reference was used in a lexical context without topic binding. (1:22)",
|
||||
"SyntaxError: Pipeline is in topic style but does not use topic reference. (1:9)"
|
||||
],
|
||||
"program": {
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
"type": "File",
|
||||
"start":0,"end":77,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}},
|
||||
"errors": [
|
||||
"SyntaxError: Topic reference was used in a lexical context without topic binding. (2:49)",
|
||||
"SyntaxError: Topic reference was used in a lexical context without topic binding. (2:48)",
|
||||
"SyntaxError: Pipeline is in topic style but does not use topic reference. (2:11)"
|
||||
],
|
||||
"program": {
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
"type": "File",
|
||||
"start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":49}},
|
||||
"errors": [
|
||||
"SyntaxError: Topic reference was used in a lexical context without topic binding. (1:46)",
|
||||
"SyntaxError: Topic reference was used in a lexical context without topic binding. (1:45)",
|
||||
"SyntaxError: Pipeline is in topic style but does not use topic reference. (1:9)"
|
||||
],
|
||||
"program": {
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
"type": "File",
|
||||
"start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}},
|
||||
"errors": [
|
||||
"SyntaxError: Topic reference was used in a lexical context without topic binding. (1:33)",
|
||||
"SyntaxError: Topic reference was used in a lexical context without topic binding. (1:32)",
|
||||
"SyntaxError: Pipeline is in topic style but does not use topic reference. (1:9)"
|
||||
],
|
||||
"program": {
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
"type": "File",
|
||||
"start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}},
|
||||
"errors": [
|
||||
"SyntaxError: Topic reference was used in a lexical context without topic binding. (1:35)",
|
||||
"SyntaxError: Topic reference was used in a lexical context without topic binding. (1:34)",
|
||||
"SyntaxError: Pipeline is in topic style but does not use topic reference. (1:9)"
|
||||
],
|
||||
"program": {
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
"type": "File",
|
||||
"start":0,"end":78,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}},
|
||||
"errors": [
|
||||
"SyntaxError: Topic reference was used in a lexical context without topic binding. (3:33)"
|
||||
"SyntaxError: Topic reference was used in a lexical context without topic binding. (3:32)"
|
||||
],
|
||||
"program": {
|
||||
"type": "Program",
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
"type": "File",
|
||||
"start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}},
|
||||
"errors": [
|
||||
"SyntaxError: Topic reference was used in a lexical context without topic binding. (1:35)",
|
||||
"SyntaxError: Topic reference was used in a lexical context without topic binding. (1:34)",
|
||||
"SyntaxError: Pipeline is in topic style but does not use topic reference. (1:9)"
|
||||
],
|
||||
"program": {
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
"type": "File",
|
||||
"start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}},
|
||||
"errors": [
|
||||
"SyntaxError: Topic reference was used in a lexical context without topic binding. (1:25)",
|
||||
"SyntaxError: Topic reference was used in a lexical context without topic binding. (1:24)",
|
||||
"SyntaxError: Pipeline is in topic style but does not use topic reference. (1:9)"
|
||||
],
|
||||
"program": {
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
"type": "File",
|
||||
"start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}},
|
||||
"errors": [
|
||||
"SyntaxError: Topic reference was used in a lexical context without topic binding. (1:21)",
|
||||
"SyntaxError: Topic reference was used in a lexical context without topic binding. (1:19)",
|
||||
"SyntaxError: Pipeline is in topic style but does not use topic reference. (1:5)"
|
||||
],
|
||||
"program": {
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
"type": "File",
|
||||
"start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}},
|
||||
"errors": [
|
||||
"SyntaxError: Topic reference was used in a lexical context without topic binding. (1:21)",
|
||||
"SyntaxError: Topic reference was used in a lexical context without topic binding. (1:19)",
|
||||
"SyntaxError: Pipeline is in topic style but does not use topic reference. (1:5)"
|
||||
],
|
||||
"program": {
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
"type": "File",
|
||||
"start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}},
|
||||
"errors": [
|
||||
"SyntaxError: Topic reference was used in a lexical context without topic binding. (1:5)"
|
||||
"SyntaxError: Topic reference was used in a lexical context without topic binding. (1:4)"
|
||||
],
|
||||
"program": {
|
||||
"type": "Program",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user