Expand .raise() to allow more options.
This commit is contained in:
parent
aa669ef902
commit
5c3092d86f
@ -13,7 +13,11 @@ export default class LocationParser extends CommentsParser {
|
|||||||
raise(
|
raise(
|
||||||
pos: number,
|
pos: number,
|
||||||
message: string,
|
message: string,
|
||||||
|
{
|
||||||
|
missingPluginNames,
|
||||||
|
}: {
|
||||||
missingPluginNames?: Array<string>,
|
missingPluginNames?: Array<string>,
|
||||||
|
} = {},
|
||||||
): empty {
|
): empty {
|
||||||
const loc = getLineInfo(this.input, pos);
|
const loc = getLineInfo(this.input, pos);
|
||||||
message += ` (${loc.line}:${loc.column})`;
|
message += ` (${loc.line}:${loc.column})`;
|
||||||
|
|||||||
@ -120,7 +120,7 @@ export default class UtilParser extends Tokenizer {
|
|||||||
throw this.raise(
|
throw this.raise(
|
||||||
pos != null ? pos : this.state.start,
|
pos != null ? pos : this.state.start,
|
||||||
`This experimental syntax requires enabling the parser plugin: '${name}'`,
|
`This experimental syntax requires enabling the parser plugin: '${name}'`,
|
||||||
[name],
|
{ missingPluginNames: [name] },
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -134,7 +134,7 @@ export default class UtilParser extends Tokenizer {
|
|||||||
`This experimental syntax requires enabling one of the following parser plugin(s): '${names.join(
|
`This experimental syntax requires enabling one of the following parser plugin(s): '${names.join(
|
||||||
", ",
|
", ",
|
||||||
)}'`,
|
)}'`,
|
||||||
names,
|
{ missingPluginNames: names },
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user