Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1105)

Unified Diff: dart/tests/lib/mirrors/metadata_test.dart

Issue 16156013: Implement metadata for instance fields. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Found an issue during testing. Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « dart/tests/lib/lib.status ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/tests/lib/mirrors/metadata_test.dart
diff --git a/dart/tests/lib/mirrors/metadata_test.dart b/dart/tests/lib/mirrors/metadata_test.dart
index b7e9a3b42fbe96e1f85ee3f88765c870796dde79..8b54b6ee29c1cbfba9b3978545b1e2ea3f7b5272 100644
--- a/dart/tests/lib/mirrors/metadata_test.dart
+++ b/dart/tests/lib/mirrors/metadata_test.dart
@@ -2,18 +2,23 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-@fisk @symbol
+@string @symbol
library test.metadata_test;
import 'dart:mirrors';
-const fisk = 'a metadata string';
+const string = 'a metadata string';
-const symbol = const Symbol('fisk');
+const symbol = const Symbol('symbol');
-@symbol @fisk
+const hest = 'hest';
+
+@symbol @string
class MyClass {
- @fisk @symbol @fisk
+ @hest @hest @symbol
+ var x;
+
+ @string @symbol @string
myMethod() => 1;
}
@@ -36,9 +41,9 @@ checkMetadata(DeclarationMirror mirror, List expectedMetadata) {
print(metadata);
}
-@symbol @fisk @symbol
+@symbol @string @symbol
main() {
- if (MirrorSystem.getName(symbol) != 'fisk') {
+ if (MirrorSystem.getName(symbol) != 'symbol') {
// This happened in dart2js due to how early library metadata is
// computed.
throw 'Bad constant: $symbol';
@@ -46,12 +51,16 @@ main() {
MirrorSystem mirrors = currentMirrorSystem();
checkMetadata(mirrors.findLibrary(const Symbol('test.metadata_test')).first,
- [fisk, symbol]);
- checkMetadata(reflect(new MyClass()).type, [symbol, fisk]);
+ [string, symbol]);
+ ClassMirror myClassMirror = reflectClass(MyClass);
+ checkMetadata(myClassMirror, [symbol, string]);
ClosureMirror closure = reflect(main);
- checkMetadata(closure.function, [symbol, fisk, symbol]);
+ checkMetadata(closure.function, [symbol, string, symbol]);
closure = reflect(new MyClass().myMethod);
- checkMetadata(closure.function, [fisk, symbol, fisk]);
+ checkMetadata(closure.function, [string, symbol, string]);
+
+ VariableMirror xMirror = myClassMirror.variables[const Symbol('x')];
+ checkMetadata(xMirror, [hest, hest, symbol]);
// TODO(ahe): Test local functions.
}
« no previous file with comments | « dart/tests/lib/lib.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698