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

Issue 1158693003: dart2js cps: Change how type variables are accessed in constructors. (Closed)

Created:
5 years, 6 months ago by asgerf
Modified:
5 years, 6 months ago
Reviewers:
karlklose, floitsch
CC:
reviews_dartlang.org
Base URL:
git@github.com:dart-lang/sdk.git@master
Target Ref:
refs/heads/master
Visibility:
Public.

Description

dart2js cps: Change how type variables are accessed in constructors. Previously there was a problem with type variables referenced inside a closure inside a field initializer, like so: class Foo<T> { var field = () => T; } The type variable cannot be accessed on 'this' because the closure is created before 'this'. It also cannot be accessed as a parameter. It is now properly treated as an unboxed free variable, and at closure creation the value is taken from the constructor parameter holding the type variable. As with everything else during constructor build-up, the type variables are now held in the IR builder's environment. It has proven to be a robust way of doing things so far. This simplifies the IR builder's role in this. The builder will not detect how a type variable should be accessed (i.e. "if inside a closure inside a field..."). If the type variable is in the environment that's the one it will use, otherwise it defaults to extract it from the receiver object. Also, the closure conversion phase now detects type variables mentioned in "on T catch()" clauses. BUG= R=karlklose@google.com Committed: https://github.com/dart-lang/sdk/commit/5f97e22d8064d2e6abd93e9d4ecb1f9f2345bfc5

Patch Set 1 #

Total comments: 13

Patch Set 2 : Comments #

Patch Set 3 : Moved test into non-cps section #

Patch Set 4 : Rebase + status file #

Unified diffs Side-by-side diffs Delta from patch set Stats (+94 lines, -46 lines) Patch
M pkg/compiler/lib/src/closure.dart View 1 2 chunks +13 lines, -1 line 0 comments Download
M pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart View 1 2 3 3 chunks +20 lines, -24 lines 0 comments Download
M pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart View 1 6 chunks +53 lines, -10 lines 0 comments Download
M tests/language/language_dart2js.status View 1 2 3 6 chunks +8 lines, -11 lines 0 comments Download

Messages

Total messages: 5 (1 generated)
asgerf
https://codereview.chromium.org/1158693003/diff/1/tests/language/language_dart2js.status File tests/language/language_dart2js.status (right): https://codereview.chromium.org/1158693003/diff/1/tests/language/language_dart2js.status#newcode677 tests/language/language_dart2js.status:677: generic_field_mixin3_test : RuntimeError It seems there is a class ...
5 years, 6 months ago (2015-05-27 16:31:52 UTC) #2
karlklose
LGTM. https://codereview.chromium.org/1158693003/diff/1/pkg/compiler/lib/src/closure.dart File pkg/compiler/lib/src/closure.dart (right): https://codereview.chromium.org/1158693003/diff/1/pkg/compiler/lib/src/closure.dart#newcode1090 pkg/compiler/lib/src/closure.dart:1090: if (node.formals != null) node.formals.visitChildren(this); Use {}. https://codereview.chromium.org/1158693003/diff/1/pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart ...
5 years, 6 months ago (2015-05-28 08:12:19 UTC) #3
asgerf
https://codereview.chromium.org/1158693003/diff/1/pkg/compiler/lib/src/closure.dart File pkg/compiler/lib/src/closure.dart (right): https://codereview.chromium.org/1158693003/diff/1/pkg/compiler/lib/src/closure.dart#newcode1090 pkg/compiler/lib/src/closure.dart:1090: if (node.formals != null) node.formals.visitChildren(this); On 2015/05/28 08:12:19, karlklose ...
5 years, 6 months ago (2015-05-28 09:34:21 UTC) #4
asgerf
5 years, 6 months ago (2015-05-28 12:46:41 UTC) #5
Message was sent while issue was closed.
Committed patchset #4 (id:60001) manually as
5f97e22d8064d2e6abd93e9d4ecb1f9f2345bfc5 (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698