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

Unified Diff: pkg/kernel/testcases/interpreter/instance_and_static_fields_test.dart

Issue 3002013002: Fix initialization of instance fields. (Closed)
Patch Set: Add test with instance and static fields. Created 3 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: pkg/kernel/testcases/interpreter/instance_and_static_fields_test.dart
diff --git a/pkg/kernel/testcases/interpreter/instance_and_static_fields_test.dart b/pkg/kernel/testcases/interpreter/instance_and_static_fields_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..8b3ef9a6fdea11a9102df1207f690c1fab94bcd4
--- /dev/null
+++ b/pkg/kernel/testcases/interpreter/instance_and_static_fields_test.dart
@@ -0,0 +1,29 @@
+// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library object_field_initializers_test;
+
+/// Simple program creating an object with instance field initializers and
+/// static fields in the declaration of the class.
+void main() {
+ print('Create instance of A');
+ var a1 = new A();
+ print(a1.foo1);
+ print(a1.foo2);
+ print(a1.foo3);
+
+ print('Read staticFoo');
+ print(A.staticFoo);
+}
+
+class A {
+ static String staticFoo = 'staticFoo';
+ String foo1 = 'foo1';
+ String foo2;
+ String foo3 = 'foo3';
+
+ A() {
+ this.foo2 = 'foo2';
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698