| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | |
| 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. | |
| 4 | |
| 5 var staticClosure; | |
| 6 staticMethod() => 42; | |
| 7 | |
| 8 class B { | |
| 9 var instanceClosure; | |
| 10 var nullField; | |
| 11 instanceMethod() => 43; | |
| 12 } | |
| 13 | |
| 14 checkUntyped(closure) { | |
| 15 Expect.isTrue(closure is Function); | |
| 16 } | |
| 17 | |
| 18 checkTyped(int closure()) { | |
| 19 Expect.isTrue(closure is Function); | |
| 20 } | |
| 21 | |
| 22 checkTypedNull(int closure()) { | |
| 23 Expect.isFalse(closure is Function); | |
| 24 } | |
| 25 | |
| 26 checkUntypedNull(closure) { | |
| 27 Expect.isFalse(closure is Function); | |
| 28 } | |
| 29 | |
| 30 main() { | |
| 31 staticClosure = () => 44; | |
| 32 B b = new B(); | |
| 33 b.instanceClosure = () => 45; | |
| 34 | |
| 35 closureStatement() => 46; | |
| 36 var closureExpression = () => 47; | |
| 37 | |
| 38 checkUntyped(staticClosure); | |
| 39 checkTyped(staticClosure); | |
| 40 | |
| 41 checkUntyped(staticMethod); | |
| 42 checkTyped(staticMethod); | |
| 43 | |
| 44 checkUntyped(b.instanceClosure); | |
| 45 checkTyped(b.instanceClosure); | |
| 46 | |
| 47 checkUntyped(b.instanceMethod); | |
| 48 checkTyped(b.instanceMethod); | |
| 49 | |
| 50 checkUntyped(closureStatement); | |
| 51 checkTyped(closureStatement); | |
| 52 | |
| 53 checkUntyped(closureExpression); | |
| 54 checkTyped(closureExpression); | |
| 55 | |
| 56 checkTypedNull(b.nullField); | |
| 57 checkUntypedNull(b.nullField); | |
| 58 } | |
| OLD | NEW |