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

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

Issue 574683002: Use ConstExp for storing constants. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments. Created 6 years, 2 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
« no previous file with comments | « tests/compiler/dart2js/metadata_test.dart ('k') | tests/compiler/dart2js/mock_compiler.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 that the @MirrorsUsed annotation suppress hints and that only 5 /// Test that the @MirrorsUsed annotation suppress hints and that only
6 /// requested elements are retained for reflection. 6 /// requested elements are retained for reflection.
7 library dart2js.test.mirrors_used_test; 7 library dart2js.test.mirrors_used_test;
8 8
9 import 'package:expect/expect.dart'; 9 import 'package:expect/expect.dart';
10 import "package:async_helper/async_helper.dart"; 10 import "package:async_helper/async_helper.dart";
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 113
114 // There should at least be one metadata constant: 114 // There should at least be one metadata constant:
115 // 1. The constructed constant for 'MirrorsUsed'. 115 // 1. The constructed constant for 'MirrorsUsed'.
116 Expect.isTrue(backend.metadataConstants.length >= 1); 116 Expect.isTrue(backend.metadataConstants.length >= 1);
117 117
118 Set<Constant> compiledConstants = backend.constants.compiledConstants; 118 Set<Constant> compiledConstants = backend.constants.compiledConstants;
119 // Make sure that most of the metadata constants aren't included in the 119 // Make sure that most of the metadata constants aren't included in the
120 // generated code. 120 // generated code.
121 for (var dependency in backend.metadataConstants) { 121 for (var dependency in backend.metadataConstants) {
122 Constant constant = dependency.constant; 122 Constant constant = dependency.constant;
123 Expect.isFalse(compiledConstants.contains(constant), '$constant'); 123 Expect.isFalse(compiledConstants.contains(constant),
124 constant.toStructuredString());
124 } 125 }
125 126
126 // The type literal 'Foo' is both used as metadata, and as a plain value in 127 // The type literal 'Foo' is both used as metadata, and as a plain value in
127 // the program. Make sure that it isn't duplicated. 128 // the program. Make sure that it isn't duplicated.
128 int fooConstantCount = 0; 129 int fooConstantCount = 0;
129 for (Constant constant in compiledConstants) { 130 for (Constant constant in compiledConstants) {
130 if (constant is TypeConstant && '${constant.representedType}' == 'Foo') { 131 if (constant is TypeConstant && '${constant.representedType}' == 'Foo') {
131 fooConstantCount++; 132 fooConstantCount++;
132 } 133 }
133 } 134 }
(...skipping 29 matching lines...) Expand all
163 library lib; 164 library lib;
164 165
165 import 'dart:mirrors'; 166 import 'dart:mirrors';
166 167
167 useReflect(type) { 168 useReflect(type) {
168 print(new Symbol('Foo')); 169 print(new Symbol('Foo'));
169 print(MirrorSystem.getName(reflectClass(type).owner.qualifiedName)); 170 print(MirrorSystem.getName(reflectClass(type).owner.qualifiedName));
170 } 171 }
171 """, 172 """,
172 }; 173 };
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/metadata_test.dart ('k') | tests/compiler/dart2js/mock_compiler.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698