Chromium Code Reviews| Index: lib/dom/scripts/systemnative.py |
| diff --git a/lib/dom/scripts/systemnative.py b/lib/dom/scripts/systemnative.py |
| index b7b1a85760e26b0031d671640ab3d02e98d68eee..df28efcba4c71677a4ee44ef808e46bb8be883bd 100644 |
| --- a/lib/dom/scripts/systemnative.py |
| +++ b/lib/dom/scripts/systemnative.py |
| @@ -655,11 +655,19 @@ class NativeImplementationGenerator(systembase.BaseGenerator): |
| body.Emit(' throw "Incorrect number or type of arguments";\n'); |
| else: |
| operation = operations[0] |
| + argument_count = len(operation.arguments) |
| for position, argument in list(enumerate(operation.arguments))[::-1]: |
| if self._IsArgumentOptionalInWebCore(operation, argument): |
| - check = '%s === _null' % argument_names[position] |
| - GenerateCall(operation, position, [check]) |
| - GenerateCall(operation, len(operation.arguments), []) |
| + check = '%s !== _null' % argument_names[position] |
| + # argument_count instead of position + 1 is used here to cover one |
| + # complicated case. Consider foo(x, [Optional] y, [Optional=DefaultIsNullString] z) |
|
podivilov
2012/08/21 13:46:57
I think it's exactly the optional in the middle pr
Anton Muhin
2012/08/21 18:14:34
Yes, this _null/null distinction is another of pro
|
| + # (as of now it's modelled after HTMLMediaElement.webkitAddKey). |
| + # y is optional in WebCore, while z is not. |
| + # In this case, if y !== _null, we'd like to emit foo(x, y, z) invocation, not |
| + # foo(x, y). |
| + GenerateCall(operation, argument_count, [check]) |
| + argument_count = position |
| + GenerateCall(operation, argument_count, []) |
| def SecondaryContext(self, interface): |
| pass |