mirror of
https://github.com/dart-lang/sdk
synced 2024-11-02 12:24:24 +00:00
40611dd611
TBR=kustermann@google.com BUG= Review URL: https://codereview.chromium.org/2454993003 .
40 lines
817 B
Dart
40 lines
817 B
Dart
// 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 'package:expect/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);
|
|
}
|