1cd4107e58
Review URL: https://codereview.chromium.org//11440027 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@15795 260f80e4-7a28-3924-810f-c04153c831b5
37 lines
693 B
Dart
37 lines
693 B
Dart
// Copyright (c) 2012, 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 length = 0;
|
|
}
|
|
|
|
class B {
|
|
int length = 0;
|
|
foo(receiver) {
|
|
length++;
|
|
return receiver.length++;
|
|
}
|
|
bar(receiver) {
|
|
++length;
|
|
return ++receiver.length;
|
|
}
|
|
}
|
|
|
|
|
|
main() {
|
|
var a = new A();
|
|
var b = new B();
|
|
var c = [1,2,3];
|
|
|
|
Expect.equals(3, b.foo(c));
|
|
Expect.equals(5, b.bar(c));
|
|
Expect.equals(5, c.length);
|
|
|
|
Expect.equals(0, b.foo(a));
|
|
Expect.equals(2, b.bar(a));
|
|
Expect.equals(2, a.length);
|
|
|
|
Expect.equals(4, b.length);
|
|
}
|