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

Issue 8912017: Fix missing trampolines for named arguments. (Closed)

Created:
9 years ago by sra1
Modified:
9 years ago
Reviewers:
Jennifer Messerly
CC:
reviews_dartlang.org, jimhug
Visibility:
Public.

Description

Fix missing trampolines for named arguments. To elide the trampoline, the named arguments must be in exactly the right positions, and not merely in the correct order to preserve evaluation order semantics. BUG= TEST= Committed: https://code.google.com/p/dart/source/detail?r=2418

Patch Set 1 #

Patch Set 2 : status #

Patch Set 3 : remove comment #

Total comments: 8
Unified diffs Side-by-side diffs Delta from patch set Stats (+40 lines, -7 lines) Patch
M frog/gen.dart View 1 chunk +1 line, -1 line 0 comments Download
M frog/member.dart View 1 chunk +12 lines, -0 lines 4 comments Download
M frog/minfrog View 3 chunks +16 lines, -2 lines 0 comments Download
M frog/var_member.dart View 3 chunks +10 lines, -3 lines 4 comments Download
M tests/language/language.status View 1 2 2 chunks +1 line, -1 line 0 comments Download

Messages

Total messages: 3 (0 generated)
sra1
9 years ago (2011-12-14 08:01:44 UTC) #1
Jennifer Messerly
Thanks for this fix! lgtm http://codereview.chromium.org/8912017/diff/4001/frog/member.dart File frog/member.dart (right): http://codereview.chromium.org/8912017/diff/4001/frog/member.dart#newcode820 frog/member.dart:820: bool namesInHomePositions(Arguments args) { ...
9 years ago (2011-12-14 19:15:32 UTC) #2
sra1
9 years ago (2011-12-14 22:04:32 UTC) #3
Comments addressed in http://codereview.chromium.org/8915021

http://codereview.chromium.org/8912017/diff/4001/frog/member.dart
File frog/member.dart (right):

http://codereview.chromium.org/8912017/diff/4001/frog/member.dart#newcode820
frog/member.dart:820: bool namesInHomePositions(Arguments args) {
On 2011/12/14 19:15:33, John Messerly wrote:
> mind adding a comment to this? I'm not familiar with the term "home positions"
> 
> I was wondering if this works for cases like:
> 
> class Foo { foo(a,[b=1,c=2,d=3]) { print(d); } }
> main() { var f = new Foo(); f.foo(0,b:4,c:5); }
> 
> ... discovered, it does, because _useDirectCall checks that any trailing
default
> args are null.

Done.

http://codereview.chromium.org/8912017/diff/4001/frog/member.dart#newcode824
frog/member.dart:824: if (i >= parameters.length)
On 2011/12/14 19:15:33, John Messerly wrote:
> style nit: ifs should be one line, or use { ... }

Done.

http://codereview.chromium.org/8912017/diff/4001/frog/var_member.dart
File frog/var_member.dart (right):

http://codereview.chromium.org/8912017/diff/4001/frog/var_member.dart#newcode248
frog/var_member.dart:248: // collide with any other name.
On 2011/12/14 19:15:33, John Messerly wrote:
> Some examples would be helpful--I'm not sure what kinds of things you're
worried
> about.
> 
> FWIW, there are some things on "world" that might help:
>     toJsIdentifier -> currently built assuming ':' appears in only certain
> positions, but could be generalized like you did here.
>     _addTopName -> tracks top level names to handle collisions
> 
> we do prevent user methods from containing a single '$', and our special ones
> should only have a leading $. (i'm also moving the special ones to
natives.dart,
> where they go through better name collision detection, fwiw)

Done.

http://codereview.chromium.org/8912017/diff/4001/frog/var_member.dart#newcode255
frog/var_member.dart:255: nameBuilder.add('${name.length}');
On 2011/12/14 19:15:33, John Messerly wrote:
> do you need length here, or would it be enough to add something like _ before
> and after the name? mostly asking out of curiosity -- the length works for me
> too.

I've kept the length.  If you put '_' in there, how do you tell the added '_'
from pre-existing ones?  A good way to think about this kind of encoding is to
imagine the code for reversing the transformation.

Powered by Google App Engine
This is Rietveld 408576698