Skip to content

webidl: Implement sequences in unions - #9304

Merged
bors-servo merged 5 commits into
servo:masterfrom
emilio:sequence-in-unions
Jan 17, 2016
Merged

bors-servo merged 5 commits into
servo:masterfrom
emilio:sequence-in-unions

Conversation

@emilio

@emilio emilio commented Jan 14, 2016

Copy link
Copy Markdown
Member

Unblocks #9053

Review on Reviewable

@highfive highfive added the S-awaiting-review There is new code that needs to be reviewed. label Jan 14, 2016
@highfive

Copy link
Copy Markdown

warning Warning warning

  • These commits modify script code, but no tests are modified. Please consider adding a test!

@emilio

emilio commented Jan 14, 2016

Copy link
Copy Markdown
Member Author

r? @jdm or @nox

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line can be removed from both branches of the conditional since it's the same

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless you did that thinking other object types might get added to the conditional

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah eventually other types might be added.

It seems to me that that line would be necessary in all of them though (we're inside of hasObjectTypes), so I'll take it out of the conditional.

@jdm

jdm commented Jan 14, 2016

Copy link
Copy Markdown
Member

r? @nox is probably a better bet at this point

@highfive highfive assigned nox and unassigned jdm Jan 14, 2016
@emilio
emilio force-pushed the sequence-in-unions branch from 5d3b228 to cf997b2 Compare January 14, 2016 04:18
@nox

nox commented Jan 15, 2016

Copy link
Copy Markdown
Contributor

What happens if the type is DOMString or sequence<Blob>?

-S-awaiting-review +S-awaiting-answer


Reviewed 2 of 3 files at r1, 1 of 1 files at r2.
Review status: all files reviewed at latest revision, 1 unresolved discussion.


Comments from the review on Reviewable.io

@nox nox added S-awaiting-answer Someone asked a question that requires an answer. and removed S-awaiting-review There is new code that needs to be reviewed. labels Jan 15, 2016
@emilio
emilio force-pushed the sequence-in-unions branch from cf997b2 to 87f1e2b Compare January 15, 2016 12:42
@highfive highfive added the S-awaiting-review There is new code that needs to be reviewed. label Jan 15, 2016
@emilio
emilio force-pushed the sequence-in-unions branch from 87f1e2b to e2e8313 Compare January 15, 2016 12:51
@emilio

emilio commented Jan 15, 2016

Copy link
Copy Markdown
Member Author

Good catch! (it only generated code for the former).

I fixed it, and also implemented FromJSValConvertible for Root. It's needed to allow conversion from a HandleValue to a Vec<Root<T>>.

I think the implementation is correct, but since you probably know better than I if root_from_handlevalue suits correctly there.

Sequence interfaces return values worked before, but had no test.

Sequence interface arguments didn't work until the previous commit.
@emilio
emilio force-pushed the sequence-in-unions branch from e2e8313 to 601ff74 Compare January 15, 2016 13:20
@emilio emilio removed the S-awaiting-answer Someone asked a question that requires an answer. label Jan 15, 2016
That way it does not depend on the return value for the same type.

This hopefully makes the code more clear, and avoids errors if something
changes in the future (for example, we could want to pass slices as
sequence arguments).
@emilio
emilio force-pushed the sequence-in-unions branch from 601ff74 to 9508219 Compare January 15, 2016 13:31
@nox

nox commented Jan 15, 2016

Copy link
Copy Markdown
Contributor

@Ms2ger Do we care about the Vec<Root<T>> here? Union types are weird anyway so I'm tempted to say no.

@Ms2ger

Ms2ger commented Jan 15, 2016

Copy link
Copy Markdown
Contributor

Not sure.

@jdm

jdm commented Jan 15, 2016

Copy link
Copy Markdown
Member

@nox Care about in what sense? We established that Vec<Root<T>> isn't a memory-safety issue, at least.

@nox

nox commented Jan 16, 2016

Copy link
Copy Markdown
Contributor

@bors-servo r+

@jdm Sure, but that is at odds with sequence<Blob> which just ends up as &[&Blob] in the Rust code.

@bors-servo

Copy link
Copy Markdown
Contributor

📌 Commit 9508219 has been approved by nox

@highfive highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-awaiting-review There is new code that needs to be reviewed. labels Jan 16, 2016
@frewsxcv

Copy link
Copy Markdown
Contributor

Related to Vec<Root<T>>: #8737

@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Testing commit 9508219 with merge d059cf9...

bors-servo pushed a commit that referenced this pull request Jan 17, 2016
@bors-servo

Copy link
Copy Markdown
Contributor

⛄ The build was interrupted to prioritize another pull request.

@Manishearth

Copy link
Copy Markdown
Member

@bors-servo p=2 force

@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Testing commit 9508219 with merge 2f0daa1...

bors-servo pushed a commit that referenced this pull request Jan 17, 2016
@bors-servo

Copy link
Copy Markdown
Contributor

☀️ Test successful - android, gonk, linux-dev, linux-rel, mac-dev-unit, mac-rel-css, mac-rel-wpt

@bors-servo
bors-servo merged commit 9508219 into servo:master Jan 17, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants