Skip to content

Emit iterable arguments for ES2015+#699

Merged
sandersn merged 3 commits intomicrosoft:masterfrom
saschanaz:iterable-arguments
Jun 6, 2019
Merged

Emit iterable arguments for ES2015+#699
sandersn merged 3 commits intomicrosoft:masterfrom
saschanaz:iterable-arguments

Conversation

@saschanaz
Copy link
Copy Markdown
Collaborator

Copy link
Copy Markdown
Member

@sandersn sandersn left a comment

Choose a reason for hiding this comment

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

A few small comments.

Comment thread src/emitter.ts Outdated
return !!s.param && s.param.some(p => typeIncludesSequence(p.type));
}

function filterSignaturesWithSequence(signature: Browser.Signature[]): Browser.Signature[] {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: can you name the function replaceSignaturesWithSequence and the parameter signatures?

Comment thread src/emitter.ts Outdated
Comment thread src/emitter.ts Outdated
function filterSignaturesWithSequence(signature: Browser.Signature[]): Browser.Signature[] {
return signature.filter(hasSequenceArgument).map(s => {
const newParams = s.param!.map(p => {
const typedef = typeof p.type === "string" ? sequenceTypedefMap[p.type]: undefined;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

you could drop lines 1227-1229 if you use p.type instead of undefined. It's less efficient but that's not a concern here.

Suggested change
const typedef = typeof p.type === "string" ? sequenceTypedefMap[p.type]: undefined;
const typedef = typeof p.type === "string" ? sequenceTypedefMap[p.type] : p.type;

Copy link
Copy Markdown
Collaborator Author

@saschanaz saschanaz Jun 5, 2019

Choose a reason for hiding this comment

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

Doing that will break code as sequenceTypedefMap[p.type] also can be undefined.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

That makes sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

WebGL IDL generated types should use ArrayLike<*> for sequence<*>

2 participants