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

Issue 9211005: Support static/global field initializations. (Closed)

Created:
8 years, 11 months ago by floitsch
Modified:
8 years, 11 months ago
Reviewers:
ngeoffray, kasperl
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Support static/global field initializations. Works for literals (except String) and references to other fields. Committed: https://code.google.com/p/dart/source/detail?r=3392

Patch Set 1 #

Patch Set 2 : Added test. #

Total comments: 4

Patch Set 3 : 4 space indent. #

Total comments: 2

Patch Set 4 : rebase #

Patch Set 5 : Address comments and add start of error-handling. #

Total comments: 6

Patch Set 6 : Cosmetic changes. #

Patch Set 7 : Update status files. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+130 lines, -9 lines) Patch
M frog/leg/compile_time_constants.dart View 1 2 3 4 5 3 chunks +63 lines, -5 lines 0 comments Download
M frog/leg/resolver.dart View 1 2 3 4 5 6 1 chunk +0 lines, -1 line 0 comments Download
M frog/leg/warnings.dart View 1 2 3 4 2 chunks +11 lines, -0 lines 0 comments Download
M frog/tests/leg_only/leg_only.status View 1 2 3 4 5 6 1 chunk +0 lines, -1 line 0 comments Download
A frog/tests/leg_only/src/FieldInitializerTest.dart View 1 1 chunk +54 lines, -0 lines 0 comments Download
M tests/language/language-leg.status View 1 2 3 4 5 6 4 chunks +2 lines, -2 lines 0 comments Download

Messages

Total messages: 7 (0 generated)
floitsch
8 years, 11 months ago (2012-01-16 10:40:49 UTC) #1
floitsch
8 years, 11 months ago (2012-01-16 10:40:49 UTC) #2
kasperl
DBC: http://codereview.chromium.org/9211005/diff/2001/frog/leg/compile_time_constants.dart File frog/leg/compile_time_constants.dart (right): http://codereview.chromium.org/9211005/diff/2001/frog/leg/compile_time_constants.dart#newcode57 frog/leg/compile_time_constants.dart:57: new CompileTimeConstantEvaluator(this, definitions, compiler); 4 space indent. http://codereview.chromium.org/9211005/diff/2001/frog/leg/compile_time_constants.dart#newcode106 ...
8 years, 11 months ago (2012-01-16 10:44:04 UTC) #3
ngeoffray
LGTM! http://codereview.chromium.org/9211005/diff/8001/frog/leg/compile_time_constants.dart File frog/leg/compile_time_constants.dart (right): http://codereview.chromium.org/9211005/diff/8001/frog/leg/compile_time_constants.dart#newcode131 frog/leg/compile_time_constants.dart:131: // TODO(floitsch): make sure the field is final. ...
8 years, 11 months ago (2012-01-16 14:03:35 UTC) #4
floitsch
PTAL. http://codereview.chromium.org/9211005/diff/2001/frog/leg/compile_time_constants.dart File frog/leg/compile_time_constants.dart (right): http://codereview.chromium.org/9211005/diff/2001/frog/leg/compile_time_constants.dart#newcode57 frog/leg/compile_time_constants.dart:57: new CompileTimeConstantEvaluator(this, definitions, compiler); On 2012/01/16 10:44:04, kasperl ...
8 years, 11 months ago (2012-01-16 15:07:16 UTC) #5
ngeoffray
LGTM with comments. http://codereview.chromium.org/9211005/diff/13001/frog/leg/compile_time_constants.dart File frog/leg/compile_time_constants.dart (right): http://codereview.chromium.org/9211005/diff/13001/frog/leg/compile_time_constants.dart#newcode126 frog/leg/compile_time_constants.dart:126: visitSend(Send send) { Maybe add a ...
8 years, 11 months ago (2012-01-16 15:22:35 UTC) #6
floitsch
8 years, 11 months ago (2012-01-18 12:56:19 UTC) #7
https://chromiumcodereview.appspot.com/9211005/diff/13001/frog/leg/compile_ti...
File frog/leg/compile_time_constants.dart (right):

https://chromiumcodereview.appspot.com/9211005/diff/13001/frog/leg/compile_ti...
frog/leg/compile_time_constants.dart:126: visitSend(Send send) {
On 2012/01/16 15:22:35, ngeoffray wrote:
> Maybe add a helper in Elements:
> Elements.isNonInstanceFinalField().

Since I want to check for non-final accesses keeping as is.

https://chromiumcodereview.appspot.com/9211005/diff/13001/frog/leg/compile_ti...
frog/leg/compile_time_constants.dart:133: error(element);
On 2012/01/16 15:22:35, ngeoffray wrote:
> I believe this can be tested in the resolver.

this one yes, but the resolver would need a state. Since the CTC needs to check
anyways for the cases the resolver cannot handle it seems easier to keep all
checking in the CTC.
leaving as is.

https://chromiumcodereview.appspot.com/9211005/diff/13001/frog/leg/warnings.dart
File frog/leg/warnings.dart (right):

https://chromiumcodereview.appspot.com/9211005/diff/13001/frog/leg/warnings.d...
frog/leg/warnings.dart:122: class CompileTimeConstantError {
On 2012/01/16 15:22:35, ngeoffray wrote:
> I would remove this. This looks like a ResolutionError.

as discussed: keeping it, since there are CTC errors the resolver cannot catch.

Powered by Google App Engine
This is Rietveld 408576698