Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add comments for the "Constructing the form data set" algorithm #8955

Merged

Conversation

@askobara
Copy link
Contributor

askobara commented Dec 13, 2015

Fixes #7852

Review on Reviewable

@wafflespeanut
Copy link
Member

wafflespeanut commented Dec 13, 2015

Nice, this should be helpful. Some nits...


Reviewed 2 of 2 files at r1.
Review status: all files reviewed at latest revision, 2 unresolved discussions.


components/script/dom/htmlinputelement.rs, line 445 [r1] (raw file):
Nit: I think it'd be clean if we have the if inside the match arm, and move the comment to the top of the arm.


components/script/dom/htmlinputelement.rs, line 448 [r1] (raw file):
Nit: ditto (since there's only one if), and we can forget the braces :)


Comments from the review on Reviewable.io

@askobara askobara force-pushed the askobara:docs-htmlformelement-get_form_dataset branch from 3151de2 to bc7e5e5 Dec 13, 2015
@nox
Copy link
Member

nox commented Dec 13, 2015

/home/travis/build/servo/servo/components/script/dom/htmlinputelement.rs:440:9: 448:10 error: non-exhaustive patterns: `Atom { .. }` not covered [E0004]
/home/travis/build/servo/servo/components/script/dom/htmlinputelement.rs:440         match ty {
/home/travis/build/servo/servo/components/script/dom/htmlinputelement.rs:441             // Step 3.1: it's a button but it is not submitter.
/home/travis/build/servo/servo/components/script/dom/htmlinputelement.rs:442             atom!("submit") | atom!("button") | atom!("reset") if !is_submitter => return None,
/home/travis/build/servo/servo/components/script/dom/htmlinputelement.rs:443             // Step 3.1: it's the "Checkbox" or "Radio Button" and whose checkedness is false.
/home/travis/build/servo/servo/components/script/dom/htmlinputelement.rs:444             atom!("radio") | atom!("checkbox") if !self.Checked() || name.is_empty() => return None,
/home/travis/build/servo/servo/components/script/dom/htmlinputelement.rs:445             atom!("image") | atom!("file") => return None, // Unimplemented
                                                                             ...
/home/travis/build/servo/servo/components/script/dom/htmlinputelement.rs:440:9: 448:10 help: run `rustc --explain E0004` to see a detailed explanation
}
}
// Step 3.1: it's not the "Image Button" and doesn't have a name attribute.
_ if name.is_empty() => return None

This comment has been minimized.

Copy link
@KiChjang

KiChjang Dec 13, 2015

Member

This part here is what's generating the compilation error. You removed the _ match case and added a pattern guard here.

This has different semantics than the code you deleted. Previously it meant "match against all other values of ty, and if their name is empty, return None". Right now it means "match against all other values of ty that has their name empty, and return None". See the difference?

@wafflespeanut
Copy link
Member

wafflespeanut commented Dec 13, 2015

Yep, sorry I should've been more specific. I meant something like,

match foo {
    foobar => (),
    _ => if thing {
        return None;
    }
}

(braces are unnecessary)

@askobara askobara force-pushed the askobara:docs-htmlformelement-get_form_dataset branch from bc7e5e5 to 8d2f9fc Dec 14, 2015
@askobara
Copy link
Contributor Author

askobara commented Dec 14, 2015

yeah, sorry guys, I'm hurried
thanks @KiChjang for the detailed answer and @wafflespeanut for the example of code, now I hope everything is fine

@wafflespeanut
Copy link
Member

wafflespeanut commented Dec 14, 2015

1 similar comment
@KiChjang
Copy link
Member

KiChjang commented Dec 14, 2015

@bors-servo
Copy link
Contributor

bors-servo commented Dec 14, 2015

Trying commit 8d2f9fc with merge 11cdb56...

bors-servo added a commit that referenced this pull request Dec 14, 2015
… r=<try>

Add comments for the "Constructing the form data set" algorithm

Fixes #7852

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8955)
<!-- Reviewable:end -->
@Manishearth
Copy link
Member

Manishearth commented Dec 14, 2015

@bors-servo delegate=Wafflespeanut

@bors-servo
Copy link
Contributor

bors-servo commented Dec 14, 2015

✌️ @wafflespeanut can now approve this pull request

@Manishearth
Copy link
Member

Manishearth commented Dec 14, 2015

Review status: 1 of 2 files reviewed at latest revision, 3 unresolved discussions.


components/script/dom/htmlinputelement.rs, line 445 [r1] (raw file):
If you move the if inside the match arm, the match arm is unconditionally executed. We want it to be able to try the next arms if is_submitter is true


Comments from the review on Reviewable.io

@wafflespeanut
Copy link
Member

wafflespeanut commented Dec 14, 2015

@Manishearth You forgot to mention that the current changes are fine :)

@wafflespeanut
Copy link
Member

wafflespeanut commented Dec 14, 2015

@bors-servo
Copy link
Contributor

bors-servo commented Dec 14, 2015

📌 Commit 8d2f9fc has been approved by Wafflespeanut

@KiChjang
Copy link
Member

KiChjang commented Dec 14, 2015

@KiChjang
Copy link
Member

KiChjang commented Dec 14, 2015

@bors-servo try- force

@Manishearth
Copy link
Member

Manishearth commented Dec 14, 2015

@bors-servo try- r=waffles retry force

@bors-servo
Copy link
Contributor

bors-servo commented Dec 14, 2015

📌 Commit 8d2f9fc has been approved by waffles

@bors-servo
Copy link
Contributor

bors-servo commented Dec 14, 2015

Testing commit 8d2f9fc with merge 1d7f296...

bors-servo added a commit that referenced this pull request Dec 14, 2015
… r=waffles

Add comments for the "Constructing the form data set" algorithm

Fixes #7852

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8955)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Dec 14, 2015

@bors-servo bors-servo merged commit 8d2f9fc into servo:master Dec 14, 2015
2 of 3 checks passed
2 of 3 checks passed
code-review/reviewable Review in progress: 1 of 2 files reviewed, 3 unresolved discussions
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

7 participants
You can’t perform that action at this time.