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

Side by Side Diff: tests/standalone/vmservice/field_script.dart

Issue 25873005: Compile error on const instance variables (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 2 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
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library unknown_command_script; 5 library unknown_command_script;
6 6
7 import 'dart:io'; 7 import 'dart:io';
8 import 'dart:typed_data'; 8 import 'dart:typed_data';
9 9
10 class Banana { 10 class Banana {
11 final Float32List final_fixed_length_list = new Float32List(4); 11 final Float32List final_fixed_length_list = new Float32List(4);
12 Float32List fixed_length_list = new Float32List(4); 12 Float32List fixed_length_list = new Float32List(4);
13 String name = ''; 13 String name = '';
14 var a = 44; 14 var a = 44;
15 } 15 }
16 16
17 17
18 class BadBanana { 18 class BadBanana {
19 final Float32List final_fixed_length_list; 19 final Float32List final_fixed_length_list;
20 final List fixed_length_array = new List(3); 20 final List fixed_length_array = new List(3);
21 num v; 21 num v;
22 const c = 4; 22 final c = 4;
23 BadBanana() : final_fixed_length_list = new Float32List(1); 23 BadBanana() : final_fixed_length_list = new Float32List(1);
24 BadBanana.variable() : final_fixed_length_list = new Float32List(2); 24 BadBanana.variable() : final_fixed_length_list = new Float32List(2);
25 } 25 }
26 26
27 main() { 27 main() {
28 for (int i = 0; i < 2000; i++) { 28 for (int i = 0; i < 2000; i++) {
29 Banana b = new Banana(); 29 Banana b = new Banana();
30 b.name = 'Banana'; 30 b.name = 'Banana';
31 BadBanana bb = new BadBanana(); 31 BadBanana bb = new BadBanana();
32 bb.v = 1.0; 32 bb.v = 1.0;
33 } 33 }
34 var bb = new BadBanana.variable(); 34 var bb = new BadBanana.variable();
35 bb.v = 2.0; 35 bb.v = 2.0;
36 var b = new Banana(); 36 var b = new Banana();
37 b.a = 'foo'; 37 b.a = 'foo';
38 print(''); // Print blank line to signal that we are ready. 38 print(''); // Print blank line to signal that we are ready.
39 // Wait until signaled from spawning test. 39 // Wait until signaled from spawning test.
40 stdin.first.then((_) => exit(0)); 40 stdin.first.then((_) => exit(0));
41 } 41 }
OLDNEW
« no previous file with comments | « tests/language/const_escape_frog_test.dart ('k') | tests/standalone/vmservice/isolate_class_field_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698