Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(416)

Issue 10832300: Proper dispatch in the presence of optional arguments. (Closed)

Created:
8 years, 4 months ago by Anton Muhin
Modified:
8 years, 4 months ago
Reviewers:
podivilov
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Proper dispatch in the presence of optional arguments. Formerly for the methods like foo([Optional] x, [Opional] y), the following dispatcher was emitted: foo([x = _null, y = _null]) { if (y === _null) { return _foo_1(x); // WRONG! } if (x === _null) { return _foo_2(); } return _foo_3(x, y); } Now correct code is emitted: foo([x = _null, y = _null]) { if (y !== _null) { return _foo_1(x, y); } if (x !== _null) { return _foo_2(x); } return _foo_3(); } TBR=podivilov@chromium.org BUG=4487 Committed: https://code.google.com/p/dart/source/detail?r=10661

Patch Set 1 #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+11 lines, -3 lines) Patch
M lib/dom/scripts/systemnative.py View 1 chunk +11 lines, -3 lines 2 comments Download

Messages

Total messages: 4 (0 generated)
Anton Muhin
8 years, 4 months ago (2012-08-14 18:14:08 UTC) #1
Anton Muhin
I'd appreciate proper review.
8 years, 4 months ago (2012-08-14 18:14:29 UTC) #2
podivilov
https://chromiumcodereview.appspot.com/10832300/diff/1/lib/dom/scripts/systemnative.py File lib/dom/scripts/systemnative.py (right): https://chromiumcodereview.appspot.com/10832300/diff/1/lib/dom/scripts/systemnative.py#newcode663 lib/dom/scripts/systemnative.py:663: # complicated case. Consider foo(x, [Optional] y, [Optional=DefaultIsNullString] z) ...
8 years, 4 months ago (2012-08-21 13:46:57 UTC) #3
Anton Muhin
8 years, 4 months ago (2012-08-21 18:14:33 UTC) #4
https://chromiumcodereview.appspot.com/10832300/diff/1/lib/dom/scripts/system...
File lib/dom/scripts/systemnative.py (right):

https://chromiumcodereview.appspot.com/10832300/diff/1/lib/dom/scripts/system...
lib/dom/scripts/systemnative.py:663: # complicated case.  Consider foo(x,
[Optional] y, [Optional=DefaultIsNullString] z)
Yes, this _null/null distinction is another of problems I spotted in our current
code.

Updating a description...

On 2012/08/21 13:46:57, podivilov wrote:
> I think it's exactly the optional in the middle problem we had previously
since
> [Optional=DefaultIsNullString] is mandatory in dart (they finally found a
> loophole to introduce opt in the middle again :). Could you please clarify the
> comment to state it more explicitly?
> 
> Another problem is that foo(x, y) will invoke fooNativeCallback(x, y, _null)
> instead of fooNativeCallback(x, y, null).

Powered by Google App Engine
This is Rietveld 408576698