Chromium Code Reviews| 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 /** | 5 /** |
| 6 * This file is read by 'mirrors_test.dart'. | 6 * This file is read by 'mirrors_test.dart'. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 library mirrors_helper; | 9 library mirrors_helper; |
| 10 | 10 |
| 11 typedef E Func<E,F extends Foo>(F f); | 11 typedef E Func<E,F extends Foo>(F f); |
| 12 | 12 |
| 13 main() { | 13 main() { |
| 14 | 14 |
| 15 } | 15 } |
| 16 | 16 |
| 17 @Metadata | |
| 18 @Metadata(null) | |
| 19 @Metadata(true) | |
| 20 @Metadata(false) | |
| 21 @Metadata(0) | |
| 22 @Metadata(1.5) | |
| 23 @Metadata("Foo") | |
| 24 @Metadata(const ["Foo"]) | |
| 25 @Metadata(const {'foo':"Foo"}) | |
| 17 class Foo { | 26 class Foo { |
|
Andrei Mouravski
2012/12/19 14:42:02
For the sake of completeness, would you mind addin
ahe
2012/12/19 15:44:03
Line breaks don't matter. Metadata cannot be sepa
Andrei Mouravski
2012/12/19 16:31:19
Good to know.
Could you show an example of using
ahe
2012/12/19 18:11:23
Actually, qualified matches Metadata.foo. So it w
| |
| 18 | 27 |
| 19 } | 28 } |
| 20 | 29 |
| 21 interface Bar<E> { | 30 interface Bar<E> { |
| 22 | 31 |
| 23 } | 32 } |
| 24 | 33 |
| 25 class Baz<E,F extends Foo> implements Bar<E> { | 34 class Baz<E,F extends Foo> implements Bar<E> { |
| 26 Baz(); | 35 Baz(); |
| 27 const Baz.named(); | 36 const Baz.named(); |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 46 } | 55 } |
| 47 } | 56 } |
| 48 | 57 |
| 49 class _PrivateClass { | 58 class _PrivateClass { |
| 50 var _privateField; | 59 var _privateField; |
| 51 get _privateGetter => _privateField; | 60 get _privateGetter => _privateField; |
| 52 void set _privateSetter(value) => _privateField = value; | 61 void set _privateSetter(value) => _privateField = value; |
| 53 void _privateMethod() {} | 62 void _privateMethod() {} |
| 54 _PrivateClass._privateConstructor(); | 63 _PrivateClass._privateConstructor(); |
| 55 factory _PrivateClass._privateFactoryConstructor() => new _PrivateClass(); | 64 factory _PrivateClass._privateFactoryConstructor() => new _PrivateClass(); |
| 65 } | |
| 66 | |
| 67 class Metadata { | |
| 68 final data; | |
| 69 const Metadata(this.data); | |
|
ahe
2012/12/19 15:44:03
This should be an optional argument, otherwise you
Johnni Winther
2012/12/20 11:30:35
No. @Metadata is the type literal constant. It wou
| |
| 56 } | 70 } |
| OLD | NEW |