OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 // VMOptions=--enable_type_checks --enable_asserts | 4 // VMOptions=--enable_type_checks --enable_asserts |
5 | 5 |
6 typedef Handler(bool e); | 6 typedef Handler(bool e); |
7 | 7 |
8 class Hello { | 8 class Hello { |
9 Hello() {} | 9 Hello() {} |
10 void handler2(bool e) { print('handler2'); } | 10 void handler2(bool e) { |
11 static void handler1(bool e) { print('handler1'); } | 11 print('handler2'); |
12 void addEventListener(String s, Handler handler, bool status) { | 12 } |
13 handler(status); | |
14 } | |
15 | 13 |
16 static void main() { | 14 static void handler1(bool e) { |
17 final h = new Hello(); | 15 print('handler1'); |
18 h.addEventListener('click', handler1, false); | 16 } |
19 h.addEventListener('click', h.handler2, false); | 17 |
20 } | 18 void addEventListener(String s, Handler handler, bool status) { |
| 19 handler(status); |
| 20 } |
| 21 |
| 22 static void main() { |
| 23 final h = new Hello(); |
| 24 h.addEventListener('click', handler1, false); |
| 25 h.addEventListener('click', h.handler2, false); |
| 26 } |
21 } | 27 } |
22 | 28 |
23 main() { | 29 main() { |
24 Hello.main(); | 30 Hello.main(); |
25 } | 31 } |
OLD | NEW |