Skip to content

Conversation

saschanaz
Copy link
Contributor

Copy link
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.

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

function filterSignaturesWithSequence(signature: Browser.Signature[]): Browser.Signature[] {
Copy link
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?

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
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
Contributor 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
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