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

Issue 10913133: Allow closures inside lazy initializers. (Closed)

Created:
8 years, 3 months ago by floitsch
Modified:
8 years, 2 months ago
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Allow closures inside lazy initializers. BUG:http://dartbug.com/3559. Committed: https://code.google.com/p/dart/source/detail?r=13459 Committed: https://code.google.com/p/dart/source/detail?r=13467 Committed: https://code.google.com/p/dart/source/detail?r=13542

Patch Set 1 #

Total comments: 4

Patch Set 2 : rebase #

Patch Set 3 : Update status file. #

Patch Set 4 : Add another test. #

Total comments: 2

Patch Set 5 : Indent 4. #

Patch Set 6 : Remove assert #

Patch Set 7 : Rebase #

Patch Set 8 : rebase #

Patch Set 9 : Fix bad enclosing element for closures in variable initializers. #

Patch Set 10 : Add test. #

Total comments: 7

Patch Set 11 : Address comments. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+164 lines, -102 lines) Patch
M lib/compiler/implementation/closure.dart View 1 2 3 4 5 14 chunks +67 lines, -42 lines 0 comments Download
M lib/compiler/implementation/elements/elements.dart View 1 2 3 4 5 6 7 8 9 10 2 chunks +3 lines, -5 lines 0 comments Download
M lib/compiler/implementation/resolver.dart View 1 2 3 4 5 6 7 8 9 10 1 chunk +12 lines, -1 line 0 comments Download
M lib/compiler/implementation/ssa/builder.dart View 1 2 3 4 5 6 4 chunks +48 lines, -43 lines 0 comments Download
M lib/compiler/implementation/ssa/codegen.dart View 1 2 1 chunk +1 line, -1 line 0 comments Download
M tests/language/language_dart2js.status View 1 2 3 4 5 1 chunk +0 lines, -1 line 0 comments Download
M tests/language/lazy_static2_test.dart View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
A + tests/language/lazy_static5_test.dart View 1 2 3 1 chunk +3 lines, -4 lines 0 comments Download
A tests/language/lazy_static6_src.dart View 1 2 3 4 5 6 7 8 9 1 chunk +27 lines, -0 lines 0 comments Download
A + tests/language/lazy_static6_test.dart View 1 2 3 4 5 6 7 8 9 1 chunk +2 lines, -4 lines 0 comments Download

Messages

Total messages: 11 (0 generated)
floitsch
lazy_static2_test is not yet working. Some kind of resolution problem.
8 years, 3 months ago (2012-09-07 15:51:31 UTC) #1
kasperl
Do you have any tests that show that this CL is a step in the ...
8 years, 3 months ago (2012-09-10 13:44:29 UTC) #2
floitsch
CL is not yet ready to go in. Other parts of the compiler need to ...
8 years, 3 months ago (2012-09-10 19:16:07 UTC) #3
floitsch
PTAL. https://chromiumcodereview.appspot.com/10913133/diff/1/lib/compiler/implementation/closure.dart File lib/compiler/implementation/closure.dart (right): https://chromiumcodereview.appspot.com/10913133/diff/1/lib/compiler/implementation/closure.dart#newcode203 lib/compiler/implementation/closure.dart:203: void translateFunction(Element element, FunctionExpression node) { On 2012/09/10 ...
8 years, 2 months ago (2012-10-09 16:06:44 UTC) #4
kasperl
LGTM. https://chromiumcodereview.appspot.com/10913133/diff/12001/lib/compiler/implementation/ssa/builder.dart File lib/compiler/implementation/ssa/builder.dart (right): https://chromiumcodereview.appspot.com/10913133/diff/12001/lib/compiler/implementation/ssa/builder.dart#newcode385 lib/compiler/implementation/ssa/builder.dart:385: builder.mapInferredType( 4 space indent.
8 years, 2 months ago (2012-10-10 08:25:02 UTC) #5
floitsch
https://chromiumcodereview.appspot.com/10913133/diff/12001/lib/compiler/implementation/ssa/builder.dart File lib/compiler/implementation/ssa/builder.dart (right): https://chromiumcodereview.appspot.com/10913133/diff/12001/lib/compiler/implementation/ssa/builder.dart#newcode385 lib/compiler/implementation/ssa/builder.dart:385: builder.mapInferredType( On 2012/10/10 08:25:02, kasperl wrote: > 4 space ...
8 years, 2 months ago (2012-10-10 09:15:27 UTC) #6
floitsch
Had to remove the assert in 'closure.dart', since it was not always true for constructors. ...
8 years, 2 months ago (2012-10-10 12:09:38 UTC) #7
kasperl
Still LGTM.
8 years, 2 months ago (2012-10-10 12:15:34 UTC) #8
floitsch
PTAL. I have added Peter since the latest changes (Patch-set 9) are touching the resolver. ...
8 years, 2 months ago (2012-10-10 18:46:43 UTC) #9
ahe
Adding Johnni to take a look at the scope issues in the resolver. http://codereview.chromium.org/10913133/diff/19004/lib/compiler/implementation/elements/elements.dart File ...
8 years, 2 months ago (2012-10-11 07:36:05 UTC) #10
floitsch
8 years, 2 months ago (2012-10-11 13:58:12 UTC) #11
http://codereview.chromium.org/10913133/diff/19004/lib/compiler/implementatio...
File lib/compiler/implementation/elements/elements.dart (right):

http://codereview.chromium.org/10913133/diff/19004/lib/compiler/implementatio...
lib/compiler/implementation/elements/elements.dart:249: if (this.isLibrary()) {
On 2012/10/11 07:36:05, ahe wrote:
> Perhaps this method should be overridden in LibraryElement.

Done.

http://codereview.chromium.org/10913133/diff/19004/lib/compiler/implementatio...
File lib/compiler/implementation/resolver.dart (right):

http://codereview.chromium.org/10913133/diff/19004/lib/compiler/implementatio...
lib/compiler/implementation/resolver.dart:1378: Element functionEnclosing =
scope.element;
On 2012/10/11 07:36:05, ahe wrote:
> How about moving this assignment above the if statement and use the variable
in
> the test.

Done.

http://codereview.chromium.org/10913133/diff/19004/lib/compiler/implementatio...
lib/compiler/implementation/resolver.dart:1381: functionEnclosing =
enclosingElement;
On 2012/10/11 07:36:05, ahe wrote:
> This is not making any sense to me.
Added comments and a TODO(ahe).

Powered by Google App Engine
This is Rietveld 408576698