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

Issue 8913006: Expands on previous function RTT to support named/optional parameters. (Closed)

Created:
9 years ago by codefu
Modified:
9 years ago
Reviewers:
mmendez
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Expands on previous function RTT to support named/optional parameters. Issues encountered: http://code.google.com/p/dart/issues/detail?id=847 http://code.google.com/p/dart/issues/detail?id=848 BUG= TEST= Committed: https://code.google.com/p/dart/source/detail?r=2465

Patch Set 1 #

Total comments: 20

Patch Set 2 : Nits #

Unified diffs Side-by-side diffs Delta from patch set Stats (+209 lines, -88 lines) Patch
M compiler/java/com/google/dart/compiler/backend/js/GenerateJavascriptAST.java View 1 3 chunks +3 lines, -3 lines 0 comments Download
M compiler/java/com/google/dart/compiler/backend/js/RuntimeTypeInjector.java View 1 17 chunks +79 lines, -59 lines 0 comments Download
M compiler/lib/implementation/array.dart View 2 chunks +6 lines, -0 lines 0 comments Download
M compiler/lib/implementation/rtt.js View 1 11 chunks +85 lines, -22 lines 0 comments Download
M compiler/lib/implementation/string_buffer.dart View 1 chunk +3 lines, -0 lines 0 comments Download
M tests/co19/co19-compiler.status View 1 chunk +1 line, -3 lines 0 comments Download
M tests/language/language.status View 1 chunk +0 lines, -1 line 0 comments Download
A tests/language/src/FunctionTypeAlias2Test.dart View 1 chunk +32 lines, -0 lines 0 comments Download

Messages

Total messages: 3 (0 generated)
codefu
http://codereview.chromium.org/8913006/diff/1/compiler/java/com/google/dart/compiler/backend/js/RuntimeTypeInjector.java File compiler/java/com/google/dart/compiler/backend/js/RuntimeTypeInjector.java (right): http://codereview.chromium.org/8913006/diff/1/compiler/java/com/google/dart/compiler/backend/js/RuntimeTypeInjector.java#newcode1289 compiler/java/com/google/dart/compiler/backend/js/RuntimeTypeInjector.java:1289: // TODO: We need a more detailed RTT than ...
9 years ago (2011-12-14 16:12:09 UTC) #1
mmendez
lgtm with nits http://codereview.chromium.org/8913006/diff/1/compiler/java/com/google/dart/compiler/backend/js/GenerateJavascriptAST.java File compiler/java/com/google/dart/compiler/backend/js/GenerateJavascriptAST.java (right): http://codereview.chromium.org/8913006/diff/1/compiler/java/com/google/dart/compiler/backend/js/GenerateJavascriptAST.java#newcode609 compiler/java/com/google/dart/compiler/backend/js/GenerateJavascriptAST.java:609: JsNameRef mangledRttMethod = rtt.getRTTLookupMethodName(methodElement); Nit: maybe ...
9 years ago (2011-12-14 20:48:13 UTC) #2
codefu
9 years ago (2011-12-15 13:01:50 UTC) #3
http://codereview.chromium.org/8913006/diff/1/compiler/java/com/google/dart/c...
File
compiler/java/com/google/dart/compiler/backend/js/GenerateJavascriptAST.java
(right):

http://codereview.chromium.org/8913006/diff/1/compiler/java/com/google/dart/c...
compiler/java/com/google/dart/compiler/backend/js/GenerateJavascriptAST.java:609:
JsNameRef mangledRttMethod = rtt.getRTTLookupMethodName(methodElement);
On 2011/12/14 20:48:13, mmendez wrote:
> Nit: maybe mangledRttMethodRef would be a better name?

Done.

http://codereview.chromium.org/8913006/diff/1/compiler/java/com/google/dart/c...
File compiler/java/com/google/dart/compiler/backend/js/RuntimeTypeInjector.java
(left):

http://codereview.chromium.org/8913006/diff/1/compiler/java/com/google/dart/c...
compiler/java/com/google/dart/compiler/backend/js/RuntimeTypeInjector.java:254:
} else if (hasTypeParams) {
On 2011/12/14 20:48:13, mmendez wrote:
> Nit: Alternatively, you could still only pass null only if type parameters are
> at play and named.  Otherwise, you could not emit the nulls.  Small code
> savings.

We don't know if it will be named until runtime, so the named parameter is
required. To get the savings, I can re-arrange the method so that named is the
first parameter.  Calling methods would then be required to pass null if there
isn't a name.

http://codereview.chromium.org/8913006/diff/1/compiler/java/com/google/dart/c...
File compiler/java/com/google/dart/compiler/backend/js/RuntimeTypeInjector.java
(right):

http://codereview.chromium.org/8913006/diff/1/compiler/java/com/google/dart/c...
compiler/java/com/google/dart/compiler/backend/js/RuntimeTypeInjector.java:525:
return newInvocation(newQualifiedNameRef("RTT.dynamicType.$lookupRTT"));
On 2011/12/14 20:48:13, mmendez wrote:
> Nit: not part of your patch, but you could refactor the string into a
constant.

Done.

http://codereview.chromium.org/8913006/diff/1/compiler/java/com/google/dart/c...
compiler/java/com/google/dart/compiler/backend/js/RuntimeTypeInjector.java:625:
return elementInvoke;
On 2011/12/14 20:48:13, mmendez wrote:
> Nit: could assert not null here.

Done.

http://codereview.chromium.org/8913006/diff/1/compiler/java/com/google/dart/c...
compiler/java/com/google/dart/compiler/backend/js/RuntimeTypeInjector.java:671:
JsName named = scope.declareName("named");
On 2011/12/14 20:48:13, mmendez wrote:
> Nit: refactor string into constant.

Done.

http://codereview.chromium.org/8913006/diff/1/compiler/java/com/google/dart/c...
compiler/java/com/google/dart/compiler/backend/js/RuntimeTypeInjector.java:698:
public JsNameRef getRTTLookupMethodName(MethodElement methodElement) {
On 2011/12/14 20:48:13, mmendez wrote:
> Nit: could rename to getRTTLookupMethodNameRef.

Done.

http://codereview.chromium.org/8913006/diff/1/compiler/java/com/google/dart/c...
compiler/java/com/google/dart/compiler/backend/js/RuntimeTypeInjector.java:701:
if (methodElement.getEnclosingElement().getKind().equals(ElementKind.CLASS)) {
On 2011/12/14 20:48:13, mmendez wrote:
> Nit: Could use ElementKind.of(methodElement.getEnclosingElement()) ==
> ElementKind.CLASS instead.

Done.

http://codereview.chromium.org/8913006/diff/1/compiler/lib/implementation/rtt.js
File compiler/lib/implementation/rtt.js (right):

http://codereview.chromium.org/8913006/diff/1/compiler/lib/implementation/rtt...
compiler/lib/implementation/rtt.js:138: var named = false;
On 2011/12/14 20:48:13, mmendez wrote:
> Nit: could move below continue.

Done.

Powered by Google App Engine
This is Rietveld 408576698