Skip to content
This repository was archived by the owner on Jul 27, 2023. It is now read-only.

Commit dc8f422

Browse files
MichaReiserzanieb
authored andcommitted
Fix ArgWithDefault TextRange (#13)
1 parent f39a6de commit dc8f422

13 files changed

+1356
-1293
lines changed

ast/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ mod ranged;
2222

2323
#[cfg(feature = "malachite-bigint")]
2424
pub use malachite_bigint as bigint;
25-
#[cfg(feature = "num-bigint")]
25+
#[cfg(all(feature = "num-bigint", not(feature = "malachite-bigint")))]
2626
pub use num_bigint as bigint;
2727

2828
pub use builtin::*;

format/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,6 @@ itertools = "0.10.5"
1515
num-traits = { workspace = true }
1616
num-bigint = { workspace = true, optional = true }
1717
malachite-bigint = { workspace = true, optional = true }
18+
19+
[features]
20+
default = ["malachite-bigint"]

format/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#[cfg(feature = "malachite-bigint")]
22
pub use malachite_bigint as bigint;
3-
#[cfg(feature = "num-bigint")]
3+
#[cfg(all(feature = "num-bigint", not(feature = "malachite-bigint")))]
44
pub use num_bigint as bigint;
55

66
pub use crate::format::*;

parser/src/python.lalrpop

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1087,8 +1087,12 @@ ParameterDefs<ArgType>: (Vec<ast::ArgWithDefault>, Vec<ast::ArgWithDefault>) = {
10871087

10881088
ParameterDef<ArgType>: ast::ArgWithDefault = {
10891089
<i:ArgType> => i,
1090-
<mut i:ArgType> "=" <e:Test<"all">> => {
1090+
<mut i:ArgType> "=" <e:Test<"all">> <end_location:@R> => {
10911091
i.default = Some(Box::new(e));
1092+
#[cfg(feature = "all-nodes-with-ranges")]
1093+
{
1094+
i.range = optional_range(i.range.start(), end_location);
1095+
}
10921096
i
10931097
},
10941098
};

parser/src/python.rs

Lines changed: 1331 additions & 1275 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

parser/src/snapshots/rustpython_parser__function__tests__function_kw_only_args_with_defaults.snap

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

parser/src/snapshots/rustpython_parser__function__tests__function_pos_and_kw_only_args_with_defaults.snap

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

parser/src/snapshots/rustpython_parser__function__tests__function_pos_and_kw_only_args_with_defaults_and_varargs.snap

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

parser/src/snapshots/rustpython_parser__function__tests__function_pos_and_kw_only_args_with_defaults_and_varargs_and_kwargs.snap

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

parser/src/snapshots/rustpython_parser__function__tests__function_pos_args_with_defaults.snap

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

parser/src/snapshots/rustpython_parser__function__tests__lambda_kw_only_args_with_defaults.snap

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

parser/src/snapshots/rustpython_parser__function__tests__lambda_pos_args_with_defaults.snap

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

parser/src/snapshots/rustpython_parser__parser__tests__parse_class.snap

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)