| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 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 | 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 | 4 |
| 5 library test.local_function_is_static; | 5 library test.local_function_is_static; |
| 6 | 6 |
| 7 @MirrorsUsed(targets: "test.local_function_is_static") | 7 @MirrorsUsed(targets: "test.local_function_is_static") |
| 8 import 'dart:mirrors'; | 8 import 'dart:mirrors'; |
| 9 import 'package:expect/expect.dart'; | 9 import 'package:expect/expect.dart'; |
| 10 | 10 |
| 11 topLevel() => 1; | 11 topLevel() => 1; |
| 12 topLevelLocal() => () => 2; | 12 topLevelLocal() => () => 2; |
| 13 |
| 13 class C { | 14 class C { |
| 14 static klass() => 3; | 15 static klass() => 3; |
| 15 static klassLocal() => () => 4; | 16 static klassLocal() => () => 4; |
| 16 instance() => 5; | 17 instance() => 5; |
| 17 instanceLocal() => () => 6; | 18 instanceLocal() => () => 6; |
| 18 } | 19 } |
| 19 | 20 |
| 20 main() { | 21 main() { |
| 21 var f = topLevel; | 22 var f = topLevel; |
| 22 Expect.equals(1, f()); | 23 Expect.equals(1, f()); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 34 Expect.equals(4, f()); | 35 Expect.equals(4, f()); |
| 35 Expect.isTrue((reflect(f) as ClosureMirror).function.isStatic); | 36 Expect.isTrue((reflect(f) as ClosureMirror).function.isStatic); |
| 36 | 37 |
| 37 f = new C().instance; | 38 f = new C().instance; |
| 38 Expect.equals(5, f()); | 39 Expect.equals(5, f()); |
| 39 Expect.isFalse((reflect(f) as ClosureMirror).function.isStatic); | 40 Expect.isFalse((reflect(f) as ClosureMirror).function.isStatic); |
| 40 | 41 |
| 41 f = new C().instanceLocal(); | 42 f = new C().instanceLocal(); |
| 42 Expect.equals(6, f()); | 43 Expect.equals(6, f()); |
| 43 Expect.isFalse((reflect(f) as ClosureMirror).function.isStatic); | 44 Expect.isFalse((reflect(f) as ClosureMirror).function.isStatic); |
| 44 } | 45 } |
| OLD | NEW |