| 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 | 9 |
| 10 import "package:expect/expect.dart"; | 10 import "package:expect/expect.dart"; |
| 11 import "metadata_lib.dart" as Meta; | 11 import "metadata_lib.dart" as Meta; |
| 12 | 12 |
| 13 class Tag { | 13 class Tag { |
| 14 final String annotation; | 14 final String annotation; |
| 15 const Tag(this.annotation); | 15 const Tag(this.annotation); |
| 16 } | 16 } |
| 17 | 17 |
| 18 const meta1 = 1; | 18 const meta1 = 1; |
| 19 const meta2 = const Tag("meta2"); | 19 const meta2 = const Tag("meta2"); |
| 20 | 20 |
| 21 const extern = const Tag("external"); | 21 const extern = const Tag("external"); |
| 22 | 22 |
| 23 @meta1 | 23 @meta1 |
| 24 var topLevelVar; | 24 var topLevelVar; |
| 25 @Meta.Alien.unspecified() | 25 @Meta.Alien.unknown() |
| 26 List unknownUnknowns; | 26 List unknownUnknowns; |
| 27 | 27 |
| 28 @meta1 | 28 @meta1 |
| 29 typedef int DingDong<@meta2 T>(@meta1 event); | 29 typedef int DingDong<@meta2 T>(@meta1 event); |
| 30 | 30 |
| 31 @meta1 | 31 @meta1 |
| 32 class A<@Tag("typeParam") T> { | 32 class A<@Tag("typeParam") T> { |
| 33 @meta1 | 33 @meta1 |
| 34 @meta2 | 34 @meta2 |
| 35 static String staticField; | 35 static String staticField; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 53 for (@Tag("loopvar") | 53 for (@Tag("loopvar") |
| 54 int i = 0; | 54 int i = 0; |
| 55 i < 10; | 55 i < 10; |
| 56 i++) { | 56 i++) { |
| 57 // Do something. | 57 // Do something. |
| 58 } | 58 } |
| 59 | 59 |
| 60 @meta1 | 60 @meta1 |
| 61 var s = r'This is a raw \\ string.'; | 61 var s = r'This is a raw \\ string.'; |
| 62 } | 62 } |
| OLD | NEW |