Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // BSD-style license that can be found in the LICENSE file. | |
| 4 | |
| 5 // Test ensuring that compiler can parse metadata. Need to add negative | |
| 6 // test cases with illegal metadata annotations. | |
| 7 | |
| 8 class Tag { | |
| 9 final String annotation; | |
| 10 const Tag(this.annotation); | |
| 11 } | |
| 12 | |
| 13 const meta1 = 1; | |
| 14 const meta2 = const Tag("meta2"); | |
| 15 | |
| 16 const extern = const Tag("external"); | |
| 17 | |
| 18 @meta1 var topLevelVar; | |
| 19 | |
| 20 @meta1 typedef int DingDong<@meta2 T>(@meta1 event); | |
|
siva
2012/09/07 22:30:17
We probably need some cases which exercise the id.
hausner
2012/09/07 23:07:24
The form with 3 identifiers refers to a qualified
| |
| 21 | |
| 22 @meta1 class A <@Tag("typeParam") T> { | |
| 23 @meta1 @meta2 | |
| 24 static String staticField; | |
| 25 | |
| 26 @extern void foo(@meta1 bool fool, {@meta1 @Tag("opt") x: 100}) { | |
| 27 return x; | |
| 28 } | |
| 29 | |
| 30 @Tag("timewarp") | |
| 31 List<int> getNextWeeksLottoNumbers() => [1, 2, 3, 4, 5, 6]; | |
| 32 } | |
| 33 | |
| 34 @meta1 main() { | |
| 35 @meta1 var a = new A(); | |
| 36 Expect.equals(0, a.foo(false, x: 0)); | |
| 37 | |
| 38 for (@Tag("loopvar") int i = 0; i < 10; i++) { | |
| 39 // Do something. | |
| 40 } | |
|
siva
2012/09/07 22:30:17
How about:
@raw_string var string = @'this is a
hausner
2012/09/07 23:07:24
Done.
| |
| 41 } | |
| OLD | NEW |