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

Unified Diff: frog/tests/leg_only/src/GettersSettersTest.dart

Issue 9245002: Support getters and setters. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 8 years, 11 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 | « frog/leg/ssa/builder.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: frog/tests/leg_only/src/GettersSettersTest.dart
===================================================================
--- frog/tests/leg_only/src/GettersSettersTest.dart (revision 3731)
+++ frog/tests/leg_only/src/GettersSettersTest.dart (working copy)
@@ -6,6 +6,14 @@
static int foo;
+ static get bar() {
+ return foo;
+ }
+
+ static set bar(newValue) {
+ foo = newValue;
+ }
+
static testMain() {
A a = new A();
a.x = 2;
@@ -42,25 +50,22 @@
// Test static fields.
foo = 42;
Expect.equals(42, foo);
+ Expect.equals(42, bar);
A.foo = 43;
Expect.equals(43, A.foo);
+ Expect.equals(43, A.bar);
- new D().test();
-
- OverrideField of = new OverrideField();
- Expect.equals(27, of.getX_());
-
- ReferenceField rf = new ReferenceField();
- rf.x_ = 1;
- Expect.equals(1, rf.getIt());
- rf.setIt(2);
- Expect.equals(2, rf.x_);
+ bar = 42;
+ Expect.equals(42, foo);
+ Expect.equals(42, bar);
+ A.bar = 43;
+ Expect.equals(43, A.foo);
+ Expect.equals(43, A.bar);
}
}
class A {
- // TODO(fabiofmv): consider removing once http://b/4254120 is fixed.
- A() { }
+ A();
int x_;
static int foo;
@@ -98,13 +103,13 @@
}
class B extends A {
- B() : super() {}
ngeoffray 2012/01/31 16:39:26 We don't support constructor super calls.
+ B();
}
class C extends A {
int y_;
- C() : super() {
+ C() {
this.x_ = 0;
}
@@ -117,53 +122,6 @@
}
}
-class D extends A {
- D() : super() {}
-
- var x2_;
-
- set x(new_x) {
- x2_ = new_x;
- }
-
- test() {
- x = 87;
- Expect.equals(87, x2_);
- x = 42;
- Expect.equals(42, x2_);
-
- foo = 0;
ngeoffray 2012/01/31 16:39:26 We don't resolve in the super class.
- Expect.equals(0, bar);
- bar = 1;
- Expect.equals(1, foo);
- var tmp = foo;
- foo += 3;
- Expect.equals(4, bar);
- bar += 5;
- Expect.equals(9, foo);
- }
-}
-
-class OverrideField extends A {
- OverrideField() : super() {}
-
- int get x_() {
- return 27;
- }
-}
-
-class ReferenceField extends A {
- ReferenceField() : super() {}
-
- setIt(a) {
- super.x_ = a;
ngeoffray 2012/01/31 16:39:26 We don't support super property access.
- }
-
- int getIt() {
- return super.x_;
- }
-}
-
main() {
GettersSettersTest.testMain();
}
« no previous file with comments | « frog/leg/ssa/builder.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698