Files
sdk/pkg/kernel/testcases/interpreter/object_property_access.dart
T
Zhivka Gucevska 3cac905c54 Implement support for property accessors
- Evaluation of PropertyGet expression by accessing a field,
 execution of a getter or creating a method tearoff.
 - Evaluation of PropertySet expression by setting a field or
 execution of a setter.

BUG=
R=dmitryas@google.com

Review-Url: https://codereview.chromium.org/2999673002 .
2017-08-21 08:38:47 +02:00

37 lines
616 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.
library object_property_access_test;
main() {
var a1 = new A();
print(a1.a);
print(a1.b);
a1.a = 3;
print(a1.doubleA);
var a2 = new A.withArgs(1, 2);
print(a2.a);
print(a2.b);
print(a2.doubleA);
a2.setA = 42;
print(a2.a);
}
class A {
int a;
int b = 42;
A();
A.withArgs(this.a, this.b);
int get doubleA => a + a;
void set setA(int a) {
this.a = a;
}
}