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

Side by Side Diff: tests/compiler/dart2js/forloop_box_test.dart

Issue 802813004: Avoid boxing loop variables that are only mutated in initializer or update (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 import "package:expect/expect.dart";
6 import "package:async_helper/async_helper.dart";
7 import 'compiler_helper.dart';
8
9 String TEST = r'''
10 main() {
11 var a;
12 for (var i=0; i<10; i++) {
13 a = () => i;
14 }
15 print(a());
16 }
17 ''';
18
19 String NEGATIVE_TEST = r'''
20 run(f) => f();
21 main() {
22 var a;
23 for (var i=0; i<10; run(() => i++)) {
24 a = () => i;
25 }
26 print(a());
27 }
28 ''';
29
30 main() {
31 asyncTest(() => compileAll(TEST).then((generated) {
32 Expect.isTrue(generated.contains('main_closure(i)'), 'for-loop variable was boxed');
karlklose 2015/01/13 13:22:47 Break these strings to the next line.
33 }));
34 asyncTest(() => compileAll(NEGATIVE_TEST).then((generated) {
35 Expect.isFalse(generated.contains('main_closure(i)'), 'for-loop variable was not boxed');
36 }));
37 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/closure.dart ('k') | tests/compiler/dart2js/js_backend_cps_ir_closures_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698