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(
|
||||
pos: number,
|
||||
message: string,
|
||||
{
|
||||
missingPluginNames,
|
||||
}: {
|
||||
missingPluginNames?: Array<string>,
|
||||
} = {},
|
||||
): empty {
|
||||
const loc = getLineInfo(this.input, pos);
|
||||
message += ` (${loc.line}:${loc.column})`;
|
||||
|
||||
@ -120,7 +120,7 @@ export default class UtilParser extends Tokenizer {
|
||||
throw this.raise(
|
||||
pos != null ? pos : this.state.start,
|
||||
`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(
|
||||
", ",
|
||||
)}'`,
|
||||
names,
|
||||
{ missingPluginNames: names },
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user