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

Treat 'undefined' passed to optional JS arguments as missing #8854

Merged
merged 1 commit into from Dec 13, 2015
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Treat undefined arguments in JS as missing

  • Loading branch information
KiChjang committed Dec 13, 2015
commit db92a8b0303c2955e8f569418ffdf748381a4b68
@@ -1142,7 +1142,6 @@ def __init__(self, argument, index, args, argc, descriptorProvider,
"argc": argc,
"args": args
}
condition = string.Template("${index} < ${argc}").substitute(replacer)

replacementVariables = {
"val": string.Template("${args}.get(${index})").substitute(replacer),
@@ -1164,17 +1163,18 @@ def __init__(self, argument, index, args, argc, descriptorProvider,

if not argument.variadic:
if argument.optional:
condition = "{args}.get({index}).is_undefined()".format(**replacer)
if argument.defaultValue:
assert default
template = CGIfElseWrapper(condition,
CGGeneric(template),
CGGeneric(default)).define()
CGGeneric(default),
CGGeneric(template)).define()
else:
assert not default
declType = CGWrapper(declType, pre="Option<", post=">")
template = CGIfElseWrapper(condition,
CGGeneric("Some(%s)" % template),
CGGeneric("None")).define()
CGGeneric("None"),
CGGeneric("Some(%s)" % template)).define()
else:
assert not default

Some generated files are not rendered by default. Learn more.

Some generated files are not rendered by default. Learn more.

Some generated files are not rendered by default. Learn more.

@@ -24,9 +24,6 @@
[testConstructorDictionary5]
expected: FAIL

[testConstructor2undefined]
expected: FAIL

[testConstructorDictionary2irregular]
expected: FAIL

This file was deleted.

@@ -1,8 +1,5 @@
[Comment-constructor.html]
type: testharness
[new Comment(): undefined]
expected: FAIL

[new Comment() should get the correct ownerDocument across globals]
expected: FAIL

@@ -3,9 +3,6 @@
[createHTMLDocument(): URL parsing]
expected: FAIL

[createHTMLDocument test 2: undefined,undefined,""]
expected: FAIL

[createHTMLDocument(): characterSet aliases]
expected: FAIL

@@ -1,8 +1,5 @@
[Text-constructor.html]
type: testharness
[new Text(): undefined]
expected: FAIL

[new Text() should get the correct ownerDocument across globals]
expected: FAIL

This file was deleted.

This file was deleted.

@@ -1,8 +1,5 @@
[api-basics.html]
type: testharness
[Default inputs]
expected: FAIL

[Encode/decode round trip: utf-8]
expected: FAIL

This file was deleted.

This file was deleted.

This file was deleted.

ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.