Oops, fix crash in parser updates (#2108)

This commit is contained in:
Jonathan Turner 2020-07-04 13:56:54 -07:00 committed by GitHub
parent efd8a633f2
commit 04120e00e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1039,12 +1039,14 @@ fn parse_positional_argument(
}
arg
} else {
let (new_idx, arg, err) = parse_math_expression(
idx,
&lite_cmd.args[idx..(lite_cmd.args.len() - remaining_positionals)],
registry,
true,
);
let end_idx = if lite_cmd.args.len() > remaining_positionals {
lite_cmd.args.len() - remaining_positionals
} else {
lite_cmd.args.len()
};
let (new_idx, arg, err) =
parse_math_expression(idx, &lite_cmd.args[idx..end_idx], registry, true);
let span = arg.span;
let mut commands = hir::Commands::new(span);