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

Typecheck for argument/dictionary field default values #427

Open
saschanaz opened this issue Sep 29, 2019 · 12 comments
Open

Typecheck for argument/dictionary field default values #427

saschanaz opened this issue Sep 29, 2019 · 12 comments

Comments

@saschanaz
Copy link
Member

saschanaz commented Sep 29, 2019

interface mixin Mixin {
  void op(optional boolean arg = 3); // no!
};

dictionary Dict {
  DOMString str = true; // no!
};

See also whatwg/webidl#750 (comment).

@TG1999
Copy link
Contributor

TG1999 commented Sep 29, 2019

Hi I will like to work on this issue, can you explain how can I solve this issue ?

@saschanaz
Copy link
Member Author

saschanaz commented Sep 29, 2019

I think this one is rather complex and not adequate for first contributions because we should make sure typedefs and unions are correctly examined. We'll want to modify *validate() in lib/productions/argument.js and check whether the argument type allows the value type.

Note for me: Maybe some helper functions:

  • valueToType(defaultValue): Receives a default value and returns the possible type(s) of it.
  • includesType(baseType, targetType): Receives two types and returns a boolean that indicates the baseType includes targetType or not. Should include some caching to prevent infinite recursion (fix(validation): prevent infinite recursion #362 😁).

@TG1999

This comment has been minimized.

@saschanaz

This comment has been minimized.

@TG1999

This comment has been minimized.

@saschanaz

This comment has been minimized.

@TG1999

This comment has been minimized.

@TG1999

This comment has been minimized.

@saschanaz

This comment has been minimized.

@TG1999

This comment has been minimized.

@TG1999

This comment has been minimized.

@TG1999

This comment has been minimized.

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

No branches or pull requests

3 participants
@saschanaz @TG1999 and others