OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 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 | 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 // Test ensuring that compiler can parse metadata. Need to add negative | 5 // Test ensuring that compiler can parse metadata. Need to add negative |
6 // test cases with illegal metadata annotations. | 6 // test cases with illegal metadata annotations. |
7 | 7 |
8 library metadata_test.dart; | 8 library metadata_test.dart; |
9 import "package:expect/expect.dart"; | 9 import "package:expect/expect.dart"; |
10 import "metadata_lib.dart" as Meta; | 10 import "metadata_lib.dart" as Meta; |
(...skipping 11 matching lines...) Expand all Loading... |
22 @meta1 var topLevelVar; | 22 @meta1 var topLevelVar; |
23 @Meta.Alien.unspecified() List unknownUnknowns; | 23 @Meta.Alien.unspecified() List unknownUnknowns; |
24 | 24 |
25 @meta1 typedef int DingDong<@meta2 T>(@meta1 event); | 25 @meta1 typedef int DingDong<@meta2 T>(@meta1 event); |
26 | 26 |
27 @meta1 class A <@Tag("typeParam") T> { | 27 @meta1 class A <@Tag("typeParam") T> { |
28 @meta1 @meta2 | 28 @meta1 @meta2 |
29 static String staticField; | 29 static String staticField; |
30 | 30 |
31 @Meta.Alien("ET") int foo(@meta1 bool fool, {@meta1 @Tag("opt") x: 100}) { | 31 @Meta.Alien("ET") int foo(@meta1 bool fool, {@meta1 @Tag("opt") x: 100}) { |
32 return x; | 32 @meta2 @meta1 g() => 10; |
| 33 return x * g(); |
33 } | 34 } |
34 | 35 |
35 @Tag(r"timewarp") | 36 @Tag(r"timewarp") |
36 List<int> getNextWeeksLottoNumbers() => [1, 2, 3, 4, 5, 6]; | 37 List<int> getNextWeeksLottoNumbers() => [1, 2, 3, 4, 5, 6]; |
37 } | 38 } |
38 | 39 |
39 @meta1 main() { | 40 @meta1 main() { |
40 @meta1 var a = new A(); | 41 @meta1 var a = new A(); |
41 Expect.equals(0, a.foo(false, x: 0)); | 42 Expect.equals(0, a.foo(false, x: 0)); |
42 | 43 |
43 for (@Tag("loopvar") int i = 0; i < 10; i++) { | 44 for (@Tag("loopvar") int i = 0; i < 10; i++) { |
44 // Do something. | 45 // Do something. |
45 } | 46 } |
46 | 47 |
47 @meta1 var s = r'This is a raw \\ string.'; | 48 @meta1 var s = r'This is a raw \\ string.'; |
48 } | 49 } |
OLD | NEW |