Files
sdk/pkg/dev_compiler/test/codegen/methods.dart
T

47 lines
573 B
Dart

library methods;
class A {
int x() => 42;
int y(int a) {
return a;
}
int z([num b]) => b;
int zz([int b = 0]) => b;
int w(int a, {num b}) {
return a + b;
}
int ww(int a, {int b: 0}) {
return a + b;
}
int get a => x();
void set b(int b) {}
int _c = 3;
int get c => _c;
void set c(int c) {
_c = c;
}
}
class Bar {
call(x) => print('hello from $x');
}
class Foo {
final Bar bar = new Bar();
}
test() {
// looks like a method but is actually f.bar.call(...)
var f = new Foo();
f.bar("Bar's call method!");
}