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

Issue 12018015: Implement substitution for type variables. (Closed)

Created:
7 years, 11 months ago by karlklose
Modified:
7 years, 10 months ago
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Implement substitution for type variables. This change does not yet address the case where there is more than one substitution, as in this example: class S<X> {} class S1 extends S<int> {} class S2 extends S<double> {} class T implements S1, S2 {} main() { new T() is S<int>; new T() is S<double>; } Committed: https://code.google.com/p/dart/source/detail?r=18124

Patch Set 1 #

Patch Set 2 : #

Patch Set 3 : Share checkedClassses. #

Total comments: 1

Patch Set 4 : Removed obsolete function. #

Total comments: 35

Patch Set 5 : Address comments. #

Total comments: 25

Patch Set 6 : Address Nicolas' comments. #

Total comments: 6

Patch Set 7 : Regenerate checks if necessary. #

Total comments: 4
Unified diffs Side-by-side diffs Delta from patch set Stats (+357 lines, -131 lines) Patch
M sdk/lib/_internal/compiler/implementation/js_backend/backend.dart View 1 2 3 1 chunk +4 lines, -0 lines 0 comments Download
M sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart View 1 2 3 4 5 6 9 chunks +83 lines, -25 lines 0 comments Download
M sdk/lib/_internal/compiler/implementation/js_backend/namer.dart View 1 2 3 4 5 2 chunks +6 lines, -0 lines 0 comments Download
M sdk/lib/_internal/compiler/implementation/js_backend/runtime_types.dart View 1 2 3 4 5 6 5 chunks +157 lines, -30 lines 4 comments Download
M sdk/lib/_internal/compiler/implementation/lib/foreign_helper.dart View 1 2 3 1 chunk +5 lines, -0 lines 0 comments Download
M sdk/lib/_internal/compiler/implementation/lib/js_helper.dart View 1 2 3 4 5 6 chunks +62 lines, -17 lines 0 comments Download
M sdk/lib/_internal/compiler/implementation/ssa/builder.dart View 1 2 3 4 6 chunks +32 lines, -43 lines 0 comments Download
M sdk/lib/_internal/compiler/implementation/ssa/codegen.dart View 1 2 3 1 chunk +3 lines, -5 lines 0 comments Download
M sdk/lib/_internal/compiler/implementation/ssa/nodes.dart View 1 2 3 1 chunk +2 lines, -3 lines 0 comments Download
M tests/co19/co19-dart2js.status View 1 2 3 1 chunk +3 lines, -5 lines 0 comments Download
M tests/language/language_dart2js.status View 1 2 3 2 chunks +0 lines, -3 lines 0 comments Download

Messages

Total messages: 15 (0 generated)
karlklose
7 years, 11 months ago (2013-01-24 13:40:01 UTC) #1
kasperl
Karl, can you add a few pieces of generated JS code that use substitutions to ...
7 years, 10 months ago (2013-01-28 14:13:32 UTC) #2
karlklose
Here is a small example: class A<T> {} class B<U, V> {} class C<T> extends ...
7 years, 10 months ago (2013-01-29 13:38:20 UTC) #3
kasperl
Maybe you should have Johnni take a look at this too? He might be interested ...
7 years, 10 months ago (2013-01-29 15:02:34 UTC) #4
karlklose
Thanks for the comments, Kasper. https://codereview.chromium.org/12018015/diff/9002/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart File sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart (right): https://codereview.chromium.org/12018015/diff/9002/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart#newcode853 sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart:853: buffer.add('$holder.${namer.substitutionName(check)}$_=${_}$body$N'); I am using ...
7 years, 10 months ago (2013-01-30 12:01:19 UTC) #5
ngeoffray
https://codereview.chromium.org/12018015/diff/17001/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart File sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart (right): https://codereview.chromium.org/12018015/diff/17001/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart#newcode843 sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart:843: // holder object. Is there a description of the ...
7 years, 10 months ago (2013-01-30 13:05:59 UTC) #6
karlklose
Thanks for the comments, Nicolas. https://codereview.chromium.org/12018015/diff/17001/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart File sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart (right): https://codereview.chromium.org/12018015/diff/17001/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart#newcode843 sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart:843: // holder object. I ...
7 years, 10 months ago (2013-01-30 15:37:18 UTC) #7
ngeoffray
https://codereview.chromium.org/12018015/diff/17001/sdk/lib/_internal/compiler/implementation/ssa/builder.dart File sdk/lib/_internal/compiler/implementation/ssa/builder.dart (right): https://codereview.chromium.org/12018015/diff/17001/sdk/lib/_internal/compiler/implementation/ssa/builder.dart#newcode2552 sdk/lib/_internal/compiler/implementation/ssa/builder.dart:2552: return '#'; On 2013/01/30 15:37:18, karlklose wrote: > getTypeRepresentation ...
7 years, 10 months ago (2013-01-31 08:28:08 UTC) #8
Johnni Winther
LGTM (as much as I understand) https://codereview.chromium.org/12018015/diff/9002/sdk/lib/_internal/compiler/implementation/js_backend/runtime_types.dart File sdk/lib/_internal/compiler/implementation/js_backend/runtime_types.dart (right): https://codereview.chromium.org/12018015/diff/9002/sdk/lib/_internal/compiler/implementation/js_backend/runtime_types.dart#newcode150 sdk/lib/_internal/compiler/implementation/js_backend/runtime_types.dart:150: if (check.typeVariables.isEmpty || ...
7 years, 10 months ago (2013-01-31 09:17:31 UTC) #9
karlklose
Thanks for the comments, Johnni. Please take another look at the emitter part. I had ...
7 years, 10 months ago (2013-02-01 07:36:35 UTC) #10
karlklose
Thanks for the comments, Johnni. Please take another look at the emitter part. I had ...
7 years, 10 months ago (2013-02-01 07:36:37 UTC) #11
karlklose
Thanks for the comments, Johnni. Please take another look at the emitter part. I had ...
7 years, 10 months ago (2013-02-01 07:36:39 UTC) #12
Johnni Winther
https://codereview.chromium.org/12018015/diff/9006/sdk/lib/_internal/compiler/implementation/js_backend/runtime_types.dart File sdk/lib/_internal/compiler/implementation/js_backend/runtime_types.dart (right): https://codereview.chromium.org/12018015/diff/9006/sdk/lib/_internal/compiler/implementation/js_backend/runtime_types.dart#newcode207 sdk/lib/_internal/compiler/implementation/js_backend/runtime_types.dart:207: print('$cls -> $check is trivial'); Remove debugging code. https://codereview.chromium.org/12018015/diff/9006/sdk/lib/_internal/compiler/implementation/js_backend/runtime_types.dart#newcode230 ...
7 years, 10 months ago (2013-02-01 07:54:46 UTC) #13
karlklose
https://codereview.chromium.org/12018015/diff/9006/sdk/lib/_internal/compiler/implementation/js_backend/runtime_types.dart File sdk/lib/_internal/compiler/implementation/js_backend/runtime_types.dart (right): https://codereview.chromium.org/12018015/diff/9006/sdk/lib/_internal/compiler/implementation/js_backend/runtime_types.dart#newcode230 sdk/lib/_internal/compiler/implementation/js_backend/runtime_types.dart:230: onVariable(variable); For side effects: The builder calls getTypeRepresentations with ...
7 years, 10 months ago (2013-02-01 07:58:46 UTC) #14
Johnni Winther
7 years, 10 months ago (2013-02-01 08:09:11 UTC) #15
lgtm

https://codereview.chromium.org/12018015/diff/9002/sdk/lib/_internal/compiler...
File sdk/lib/_internal/compiler/implementation/js_backend/runtime_types.dart
(right):

https://codereview.chromium.org/12018015/diff/9002/sdk/lib/_internal/compiler...
sdk/lib/_internal/compiler/implementation/js_backend/runtime_types.dart:165: if
(variables.isEmpty != arguments.isEmpty) {
On 2013/02/01 07:36:35, karlklose wrote:
> I am not comparing type arguments to the same class here, so it may happen
that
> the length is different:
> I compare cls.thisType.asInstanceOf(check).typeArguments with
cls.typeVariables.

Ahh!

https://codereview.chromium.org/12018015/diff/9006/sdk/lib/_internal/compiler...
File sdk/lib/_internal/compiler/implementation/js_backend/runtime_types.dart
(right):

https://codereview.chromium.org/12018015/diff/9006/sdk/lib/_internal/compiler...
sdk/lib/_internal/compiler/implementation/js_backend/runtime_types.dart:230:
onVariable(variable);
On 2013/02/01 07:58:47, karlklose wrote:
> For side effects: The builder calls getTypeRepresentations with a callback
that
> creates instructions to retrieve the actual type argument from the object.

Add a comment. The locally visible use has no side effects.

Powered by Google App Engine
This is Rietveld 408576698