blob: 582d5b6914a1a870c160c255822ea08c022f0a36 [file] [log] [blame]
// 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.
/**
* @assertion Evaluation of an assignment a of the form v = e proceeds as
* follows:
* Let d be the innermost declaration whose name is v or v =, if it exists.
* ...
* Otherwise, if d is the declaration of a static variable, static getter or
* static setter in class C, then the assignment is equivalent to the assignment
* C.v = e.
* @description Checks that an assignment of the form v = e, where v is a name
* of a static setter in class C, is equivalent to the assignment C.v = e.
* @author sgrekhov@unipro.ru
*/
import '../../../Utils/expect.dart';
class C {
static int _v = 0;
static void set v(int val) {
_v = val;
}
static int get v => _v;
test() {
v = 1;
Expect.equals(1, C.v);
v = 2;
Expect.equals(2, C.v);
C.v = 1;
Expect.equals(1, v);
C.v = 1 + 2;
Expect.equals(3, v);
}
}
main() {
C c = new C();
c.test();
}