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

Unified Diff: tests/kernel/unsorted/super_test.dart

Issue 2451623006: Reland "Merge more Kernel infrastructure from kernel_sdk SDK fork." (Closed)
Patch Set: Fix Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/kernel/unsorted/super_mixin_test.dart ('k') | tests/kernel/unsorted/superclass_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/kernel/unsorted/super_test.dart
diff --git a/tests/kernel/unsorted/super_test.dart b/tests/kernel/unsorted/super_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..e2fc34f973089ca9cfc68d9ff6876f0457a4d9ce
--- /dev/null
+++ b/tests/kernel/unsorted/super_test.dart
@@ -0,0 +1,40 @@
+// Copyright (c) 2016, 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.
+
+import 'expect.dart';
+
+class A {
+ var field = 9;
+ var called = false;
+
+ superMethod() {
+ Expect.isTrue(field == 10);
+ called = true;
+ return true;
+ }
+}
+
+class B extends A {
+ doit() {
+ Expect.isTrue((super.field = 10) == 10);
+ Expect.isTrue(super.superMethod());
+ if (called) {
+ Expect.isTrue((super.field = 11) == 11);
+ }
+ return super.field;
+ }
+}
+
+class C extends B {
+ set field(v) {
+ throw 'should not happen';
+ }
+}
+
+main() {
+ var c = new C();
+ Expect.isTrue(c.field == 9);
+ Expect.isTrue(c.doit() == 11);
+ Expect.isTrue(c.field == 11);
+}
« no previous file with comments | « tests/kernel/unsorted/super_mixin_test.dart ('k') | tests/kernel/unsorted/superclass_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698