Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upCounterBound::Integer made to store an Integer #20304
Conversation
highfive
commented
Mar 15, 2018
|
Heads up! This PR modifies the following files:
|
highfive
commented
Mar 15, 2018
| @@ -482,7 +481,7 @@ fn parse_bound<'i, 't>( | |||
| let location = input.current_source_location(); | |||
| match *input.next()? { | |||
| Token::Number { int_value: Some(v), .. } => { | |||
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
nupurbaghel
Mar 15, 2018
•
Author
Contributor
To use Integer::parse we need to have the context, which is not available in this scope?
This comment has been minimized.
This comment has been minimized.
emilio
Mar 15, 2018
Member
The caller of this function has it though, so we should be able to start passing it to this function.
This comment has been minimized.
This comment has been minimized.
emilio
Mar 15, 2018
Member
Regarding infinite, we should do something like:
if let Ok(integer) = input.try(|input| Integer::parse(context, input)) {
return Ok(CounterBound::Integer(integer));
}
input.expect_ident_matching("infinite")?;
Ok(CounterBound::Infinite)After this change we need to add a test for calc() being allowed in counter-style, with something like: range: infinite calc(1) or something like that.
Thanks!
Also how can we change the test for CounterBound::Infinite here? Do we have to use parse for just CounterBound::Integer? |
|
Looks great with that nit addressed. I'll write the test for Firefox as soon as it lands :) |
| @@ -463,8 +462,8 @@ impl Parse for Ranges { | |||
| Ok(Ranges(Vec::new())) | |||
| } else { | |||
| input.parse_comma_separated(|input| { | |||
| let opt_start = parse_bound(input)?; | |||
| let opt_end = parse_bound(input)?; | |||
| let opt_start = parse_bound(_context, input)?; | |||
This comment has been minimized.
This comment has been minimized.
|
Also, there's #20332 on the other missing places in the same file. Thanks for fixing this! |
I have updated the suggested changes. Thank you so much for helping out :) |
|
Thanks for fixing this! @bors-servo r+ |
|
|
CounterBound::Integer made to store an Integer <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #20197 <!-- Either: --> - [x] These changes do not require tests because they involve datatype change of already existing enum CounterBound <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/20304) <!-- Reviewable:end -->
|
|
nupurbaghel commentedMar 15, 2018
•
edited by SimonSapin
./mach build -ddoes not report any errors./mach test-tidydoes not report any errorsThis change is