43b1c68803
Report error when super is used as an expression outside an initializer. Consolidated some error messages. Change-Id: Iafaeeeff8a4b72f941925cefcbc832ba47f02a79 Reviewed-on: https://dart-review.googlesource.com/23360 Commit-Queue: Aske Simon Christensen <askesc@google.com> Reviewed-by: Peter von der Ahé <ahe@google.com>
21 lines
505 B
Dart
21 lines
505 B
Dart
// 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.
|
|
class A {
|
|
int call(int x) => x * 2;
|
|
}
|
|
|
|
class B extends A {
|
|
int call(int x) => x * 3;
|
|
|
|
int call_super() {
|
|
// Assumes that super() means super.call().
|
|
// In reality, it is illegal to use it this way.
|
|
return super(5);
|
|
}
|
|
}
|
|
|
|
main() {
|
|
assert(new B().call_super() == 10);
|
|
}
|