OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2014, 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 library test.local_function_is_static; |
| 6 |
| 7 import 'dart:mirrors'; |
| 8 import 'package:expect/expect.dart'; |
| 9 |
| 10 topLevel() => 1; |
| 11 topLevelLocal() => () => 2; |
| 12 class C { |
| 13 static klass() => 3; |
| 14 static klassLocal() => () => 4; |
| 15 instance() => 5; |
| 16 instanceLocal() => () => 6; |
| 17 } |
| 18 |
| 19 main() { |
| 20 var f = topLevel; |
| 21 Expect.equals(1, f()); |
| 22 Expect.isTrue((reflect(f) as ClosureMirror).function.isStatic); |
| 23 |
| 24 f = topLevelLocal(); |
| 25 Expect.equals(2, f()); |
| 26 Expect.isTrue((reflect(f) as ClosureMirror).function.isStatic); |
| 27 |
| 28 f = C.klass; |
| 29 Expect.equals(3, f()); |
| 30 Expect.isTrue((reflect(f) as ClosureMirror).function.isStatic); |
| 31 |
| 32 f = C.klassLocal(); |
| 33 Expect.equals(4, f()); |
| 34 Expect.isTrue((reflect(f) as ClosureMirror).function.isStatic); |
| 35 |
| 36 f = new C().instance; |
| 37 Expect.equals(5, f()); |
| 38 Expect.isFalse((reflect(f) as ClosureMirror).function.isStatic); |
| 39 |
| 40 f = new C().instanceLocal(); |
| 41 Expect.equals(6, f()); |
| 42 Expect.isFalse((reflect(f) as ClosureMirror).function.isStatic); |
| 43 } |
OLD | NEW |