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

Issue 10942028: Support class and typedef literals as expressions. (Closed)

Created:
8 years, 3 months ago by karlklose
Modified:
8 years, 1 month ago
Reviewers:
ahe, ngeoffray
CC:
reviews_dartlang.org, ngeoffray
Visibility:
Public.

Description

Support class and typedef literals as expressions. For a class C, the expression 'C' returns the canonicalized instance of Type for this class. If C has type variables, they are instantiated with 'dynamic'. Committed: https://code.google.com/p/dart/source/detail?r=14515

Patch Set 1 #

Patch Set 2 : #

Patch Set 3 : #

Patch Set 4 : #

Patch Set 5 : Fix two long lines. #

Total comments: 18

Patch Set 6 : Address comments. #

Patch Set 7 : #

Patch Set 8 : #

Patch Set 9 : #

Patch Set 10 : #

Patch Set 11 : Add a comment. #

Total comments: 1

Patch Set 12 : #

Patch Set 13 : #

Patch Set 14 : #

Patch Set 15 : Add a test for literals. #

Total comments: 38

Patch Set 16 : Address comments. #

Patch Set 17 : #

Total comments: 12

Patch Set 18 : Address comments. #

Total comments: 2

Patch Set 19 : Address Peter's comments. #

Total comments: 12
Unified diffs Side-by-side diffs Delta from patch set Stats (+225 lines, -122 lines) Patch
M lib/compiler/implementation/compiler.dart View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 2 chunks +2 lines, -0 lines 0 comments Download
M lib/compiler/implementation/dart_backend/backend.dart View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +7 lines, -7 lines 1 comment Download
M lib/compiler/implementation/dart_backend/placeholder_collector.dart View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +4 lines, -0 lines 0 comments Download
M lib/compiler/implementation/js_backend/emitter.dart View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 chunk +0 lines, -1 line 0 comments Download
M lib/compiler/implementation/resolution/members.dart View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 6 chunks +26 lines, -4 lines 0 comments Download
M lib/compiler/implementation/resolved_visitor.dart View 1 2 3 4 5 6 7 8 9 10 11 3 chunks +11 lines, -3 lines 0 comments Download
M lib/compiler/implementation/runtime_types.dart View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +8 lines, -4 lines 1 comment Download
M lib/compiler/implementation/ssa/builder.dart View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 6 chunks +64 lines, -9 lines 1 comment Download
M lib/compiler/implementation/types/concrete_types_inferrer.dart View 1 2 3 4 5 6 7 8 9 10 11 3 chunks +7 lines, -1 line 0 comments Download
M tests/co19/co19-dart2dart.status View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 4 chunks +4 lines, -29 lines 0 comments Download
M tests/co19/co19-dart2js.status View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 3 chunks +5 lines, -46 lines 0 comments Download
M tests/compiler/dart2js/cpa_inference_test.dart View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +1 line, -0 lines 0 comments Download
M tests/compiler/dart2js/dart_backend_test.dart View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +1 line, -0 lines 0 comments Download
M tests/compiler/dart2js/mock_compiler.dart View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +1 line, -0 lines 0 comments Download
M tests/compiler/dart2js/resolver_test.dart View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +1 line, -0 lines 0 comments Download
A tests/language/first_class_types_literals_test.dart View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 chunk +44 lines, -0 lines 5 comments Download
M tests/language/first_class_types_test.dart View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +2 lines, -3 lines 0 comments Download
M tests/language/language.status View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 4 chunks +6 lines, -13 lines 1 comment Download
M tests/language/language_dart2js.status View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 3 chunks +28 lines, -1 line 3 comments Download
M tests/utils/dummy_compiler_test.dart View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +2 lines, -1 line 0 comments Download
M tests/utils/recursive_import_test.dart View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 17 (0 generated)
karlklose
8 years, 2 months ago (2012-10-08 08:47:08 UTC) #1
ahe
Initial comments. http://codereview.chromium.org/10942028/diff/12001/lib/compiler/implementation/resolver.dart File lib/compiler/implementation/resolver.dart (right): http://codereview.chromium.org/10942028/diff/12001/lib/compiler/implementation/resolver.dart#newcode1446 lib/compiler/implementation/resolver.dart:1446: if (resolvedReceiver != null && node.isOperator I ...
8 years, 2 months ago (2012-10-08 09:09:36 UTC) #2
ahe
http://codereview.chromium.org/10942028/diff/12001/lib/compiler/implementation/tree/nodes.dart File lib/compiler/implementation/tree/nodes.dart (right): http://codereview.chromium.org/10942028/diff/12001/lib/compiler/implementation/tree/nodes.dart#newcode303 lib/compiler/implementation/tree/nodes.dart:303: bool get isPropertyAccessOrTypeReference => argumentsNode === null; I'm having ...
8 years, 2 months ago (2012-10-08 09:13:42 UTC) #3
ngeoffray
http://codereview.chromium.org/10942028/diff/12001/lib/compiler/implementation/lib/js_helper.dart File lib/compiler/implementation/lib/js_helper.dart (right): http://codereview.chromium.org/10942028/diff/12001/lib/compiler/implementation/lib/js_helper.dart#newcode1354 lib/compiler/implementation/lib/js_helper.dart:1354: Type get runtimeType => getOrCreateCachedRuntimeType('Type'); Looks fishy that you ...
8 years, 2 months ago (2012-10-10 07:32:24 UTC) #4
karlklose
PTAL. https://codereview.chromium.org/10942028/diff/12001/lib/compiler/implementation/lib/js_helper.dart File lib/compiler/implementation/lib/js_helper.dart (right): https://codereview.chromium.org/10942028/diff/12001/lib/compiler/implementation/lib/js_helper.dart#newcode1354 lib/compiler/implementation/lib/js_helper.dart:1354: Type get runtimeType => getOrCreateCachedRuntimeType('Type'); I was trying ...
8 years, 2 months ago (2012-10-23 10:33:52 UTC) #5
ahe
https://codereview.chromium.org/10942028/diff/27001/lib/compiler/implementation/resolution/members.dart File lib/compiler/implementation/resolution/members.dart (right): https://codereview.chromium.org/10942028/diff/27001/lib/compiler/implementation/resolution/members.dart#newcode1483 lib/compiler/implementation/resolution/members.dart:1483: Element resolveSend(Send node) { Karl, this is getting too ...
8 years, 2 months ago (2012-10-23 11:54:26 UTC) #6
karlklose
PTAL. I have changed the allowedCategory to include IMPLIES_TYPE. It seems that we only have ...
8 years, 1 month ago (2012-10-31 09:02:12 UTC) #7
ngeoffray
http://codereview.chromium.org/10942028/diff/35001/lib/compiler/implementation/compiler.dart File lib/compiler/implementation/compiler.dart (right): http://codereview.chromium.org/10942028/diff/35001/lib/compiler/implementation/compiler.dart#newcode191 lib/compiler/implementation/compiler.dart:191: bool _enabledRuntimeType = false; Why private? I'd prefer to ...
8 years, 1 month ago (2012-10-31 10:33:03 UTC) #8
karlklose
http://codereview.chromium.org/10942028/diff/35001/lib/compiler/implementation/compiler.dart File lib/compiler/implementation/compiler.dart (right): http://codereview.chromium.org/10942028/diff/35001/lib/compiler/implementation/compiler.dart#newcode191 lib/compiler/implementation/compiler.dart:191: bool _enabledRuntimeType = false; I have a change to ...
8 years, 1 month ago (2012-10-31 13:01:18 UTC) #9
karlklose
8 years, 1 month ago (2012-10-31 13:03:26 UTC) #10
ngeoffray
http://codereview.chromium.org/10942028/diff/35001/lib/compiler/implementation/resolution/members.dart File lib/compiler/implementation/resolution/members.dart (right): http://codereview.chromium.org/10942028/diff/35001/lib/compiler/implementation/resolution/members.dart#newcode1592 lib/compiler/implementation/resolution/members.dart:1592: if (target != null && target.kind == ElementKind.CLASS) { ...
8 years, 1 month ago (2012-10-31 14:32:43 UTC) #11
karlklose
http://codereview.chromium.org/10942028/diff/35001/lib/compiler/implementation/resolution/members.dart File lib/compiler/implementation/resolution/members.dart (right): http://codereview.chromium.org/10942028/diff/35001/lib/compiler/implementation/resolution/members.dart#newcode1592 lib/compiler/implementation/resolution/members.dart:1592: if (target != null && target.kind == ElementKind.CLASS) { ...
8 years, 1 month ago (2012-10-31 16:32:17 UTC) #12
karlklose
http://codereview.chromium.org/10942028/diff/35001/tests/language/language.status File tests/language/language.status (right): http://codereview.chromium.org/10942028/diff/35001/tests/language/language.status#newcode19 tests/language/language.status:19: constructor_negative_test: Pass # For the wrong reason. Actually this ...
8 years, 1 month ago (2012-11-01 07:57:13 UTC) #13
ngeoffray
LGTM http://codereview.chromium.org/10942028/diff/44023/lib/compiler/implementation/resolution/members.dart File lib/compiler/implementation/resolution/members.dart (right): http://codereview.chromium.org/10942028/diff/44023/lib/compiler/implementation/resolution/members.dart#newcode1590 lib/compiler/implementation/resolution/members.dart:1590: if (target == null) { Should you check ...
8 years, 1 month ago (2012-11-01 09:57:59 UTC) #14
ahe
http://codereview.chromium.org/10942028/diff/44023/lib/compiler/implementation/compiler.dart File lib/compiler/implementation/compiler.dart (right): http://codereview.chromium.org/10942028/diff/44023/lib/compiler/implementation/compiler.dart#newcode199 lib/compiler/implementation/compiler.dart:199: void enableRuntimeTypeFunction() { Why do you need this complexity? ...
8 years, 1 month ago (2012-11-01 13:55:27 UTC) #15
karlklose
Thanks for the reviews! http://codereview.chromium.org/10942028/diff/44023/lib/compiler/implementation/compiler.dart File lib/compiler/implementation/compiler.dart (right): http://codereview.chromium.org/10942028/diff/44023/lib/compiler/implementation/compiler.dart#newcode199 lib/compiler/implementation/compiler.dart:199: void enableRuntimeTypeFunction() { It is ...
8 years, 1 month ago (2012-11-01 14:34:20 UTC) #16
ahe
8 years, 1 month ago (2012-11-05 09:47:05 UTC) #17
LGTM since you already submitted this CL.

http://codereview.chromium.org/10942028/diff/46003/lib/compiler/implementatio...
File lib/compiler/implementation/dart_backend/backend.dart (right):

http://codereview.chromium.org/10942028/diff/46003/lib/compiler/implementatio...
lib/compiler/implementation/dart_backend/backend.dart:319: if
(!shouldOutput(element) || treeElements == null) return;
Why would treeElements be null?

http://codereview.chromium.org/10942028/diff/46003/lib/compiler/implementatio...
File lib/compiler/implementation/runtime_types.dart (right):

http://codereview.chromium.org/10942028/diff/46003/lib/compiler/implementatio...
lib/compiler/implementation/runtime_types.dart:16: const
SourceString('getOrCreateCachedRuntimeType');
How about moving this to compiler.dart?

http://codereview.chromium.org/10942028/diff/46003/lib/compiler/implementatio...
File lib/compiler/implementation/ssa/builder.dart (right):

http://codereview.chromium.org/10942028/diff/46003/lib/compiler/implementatio...
lib/compiler/implementation/ssa/builder.dart:3346: Element selectorElement =
elements[node];
This is unused.

http://codereview.chromium.org/10942028/diff/46003/tests/language/first_class...
File tests/language/first_class_types_literals_test.dart (right):

http://codereview.chromium.org/10942028/diff/46003/tests/language/first_class...
tests/language/first_class_types_literals_test.dart:4: 
Please add a comment explaining what this test does.

http://codereview.chromium.org/10942028/diff/46003/tests/language/first_class...
tests/language/first_class_types_literals_test.dart:11: sameType(a, b) {
This method is not called.

http://codereview.chromium.org/10942028/diff/46003/tests/language/first_class...
tests/language/first_class_types_literals_test.dart:15: differentType(a, b) {
This method is not called.

http://codereview.chromium.org/10942028/diff/46003/tests/language/first_class...
tests/language/first_class_types_literals_test.dart:18:
Expect.isFalse(a.runtimeType === b.runtimeType);
The === operator is deprecated.

http://codereview.chromium.org/10942028/diff/46003/tests/language/first_class...
tests/language/first_class_types_literals_test.dart:24: Expect.isFalse(int ===
num);
Ditto

http://codereview.chromium.org/10942028/diff/46003/tests/language/language.st...
File tests/language/language.status (right):

http://codereview.chromium.org/10942028/diff/46003/tests/language/language.st...
tests/language/language.status:366: illegal_invocation_test/01: Fail, OK #
Typedef literals are expressions now.
Bug report number to delete the test?

http://codereview.chromium.org/10942028/diff/46003/tests/language/language_da...
File tests/language/language_dart2js.status (right):

http://codereview.chromium.org/10942028/diff/46003/tests/language/language_da...
tests/language/language_dart2js.status:6: class_literal_test/01: Fail # Class
literals are expression now; delete this test.
Bug report number to delete the test?
Shouldn't this be Fail, OK?

http://codereview.chromium.org/10942028/diff/46003/tests/language/language_da...
tests/language/language_dart2js.status:104: constructor_negative_test: Pass #
Wrong reason: the expression 'C()' is valid with class literals.
Bug number?

http://codereview.chromium.org/10942028/diff/46003/tests/language/language_da...
tests/language/language_dart2js.status:105: illegal_invocation_test/01: Fail, OK
# Typedef literals are expressions now.
Bug number?

Powered by Google App Engine
This is Rietveld 408576698