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

Side by Side Diff: dart/tests/compiler/dart2js/metadata_test.dart

Issue 10869013: Reify partial metadata. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #import("dart:uri"); 5 #import("dart:uri");
6 6
7 #import('compiler_helper.dart'); 7 #import('compiler_helper.dart');
8 8
9 #import('../../../lib/compiler/implementation/elements/elements.dart'); 9 #import('../../../lib/compiler/implementation/elements/elements.dart');
10 #import('../../../lib/compiler/implementation/leg.dart'); 10 #import('../../../lib/compiler/implementation/leg.dart');
11 11
12 void testClassMetadata() { 12 void testClassMetadata() {
13 // TODO(ahe): native should be "const", not "final". 13 // TODO(ahe): native should be "const", not "final".
14 final source = """final native = 'xyz'; 14 final source = """final native = 'xyz';
15 @native class Foo {} 15 @native class Foo {}
16 main() {}"""; 16 main() {}""";
17 17
18 check(compiler, element) { 18 check(compiler, element) {
19 return; // TODO(ahe): I'm working on the following.
20 Expect.isFalse(element.metadata.isEmpty()); 19 Expect.isFalse(element.metadata.isEmpty());
21 MetadataAnnotation annotation = element.metadata.head; 20 MetadataAnnotation annotation = element.metadata.head;
22 Expect.isNotNull(annotation); 21 Expect.isNotNull(annotation);
23 Constant value = annotation.value; 22 Constant value = annotation.value;
24 print(value); 23 return; // TODO(ahe): I'm working on the following.
24 Expect.isNotNull(value);
25 } 25 }
26 26
27 compileAndCheck(source, 'Foo', check); 27 compileAndCheck(source, 'Foo', check);
28 } 28 }
29 29
30 void testTopLevelMethodMetadata() {
31 // TODO(ahe): native should be "const", not "final".
32 final source = """final native = 'xyz';
33 @native
34 main() {}""";
35
36 check(compiler, element) {
37 Expect.isFalse(element.metadata.isEmpty());
38 MetadataAnnotation annotation = element.metadata.head;
39 Expect.isNotNull(annotation);
40 Constant value = annotation.value;
41 return; // TODO(ahe): I'm working on the following.
42 Expect.isNotNull(value);
43 }
44
45 compileAndCheck(source, 'main', check);
46 }
47
30 void main() { 48 void main() {
31 testClassMetadata(); 49 testClassMetadata();
50 testTopLevelMethodMetadata();
32 } 51 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698