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"; | |
10 import "metadata_lib.dart" as Meta; | 9 import "metadata_lib.dart" as Meta; |
11 | 10 |
12 class Tag { | 11 class Tag { |
13 final String annotation; | 12 final String annotation; |
14 const Tag(this.annotation); | 13 const Tag(this.annotation); |
15 } | 14 } |
16 | 15 |
17 const meta1 = 1; | 16 const meta1 = 1; |
18 const meta2 = const Tag("meta2"); | 17 const meta2 = const Tag("meta2"); |
19 | 18 |
(...skipping 19 matching lines...) Expand all Loading... |
39 @meta1 main() { | 38 @meta1 main() { |
40 @meta1 var a = new A(); | 39 @meta1 var a = new A(); |
41 Expect.equals(0, a.foo(false, x: 0)); | 40 Expect.equals(0, a.foo(false, x: 0)); |
42 | 41 |
43 for (@Tag("loopvar") int i = 0; i < 10; i++) { | 42 for (@Tag("loopvar") int i = 0; i < 10; i++) { |
44 // Do something. | 43 // Do something. |
45 } | 44 } |
46 | 45 |
47 @meta1 var s = r'This is a raw \\ string.'; | 46 @meta1 var s = r'This is a raw \\ string.'; |
48 } | 47 } |
OLD | NEW |