| Index: dart/tests/compiler/dart2js/mirrors_used_test.dart
|
| diff --git a/dart/tests/compiler/dart2js/mirrors_used_test.dart b/dart/tests/compiler/dart2js/mirrors_used_test.dart
|
| index fc77fdff9de9983d61ffeab47ae7e109becd8eb4..04797d5a024c2ab03f680bab7df615288dbe9e83 100644
|
| --- a/dart/tests/compiler/dart2js/mirrors_used_test.dart
|
| +++ b/dart/tests/compiler/dart2js/mirrors_used_test.dart
|
| @@ -15,7 +15,9 @@ import '../../../sdk/lib/_internal/compiler/implementation/apiimpl.dart' show
|
| Compiler;
|
|
|
| import '../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart' show
|
| - SourceString;
|
| + Constant,
|
| + SourceString,
|
| + TypeConstant;
|
|
|
| import
|
| '../../../sdk/lib/_internal/compiler/implementation/elements/elements.dart'
|
| @@ -84,6 +86,36 @@ void main() {
|
| }
|
| });
|
| }
|
| +
|
| + // There should at least be three metadata constants:
|
| + // 1. The type literal 'Foo'.
|
| + // 2. The list 'const [Foo]'.
|
| + // 3. The constructed constant for 'MirrorsUsed'.
|
| + Expect.isTrue(compiler.metadataHandler.compiledConstants.length >= 3);
|
| +
|
| + // Make sure that most of the metadata constants aren't included in the
|
| + // generated code.
|
| + for (Constant constant in compiler.metadataHandler.compiledConstants) {
|
| + if (constant is TypeConstant && '${constant.representedType}' == 'Foo') {
|
| + // The type literal 'Foo' is retained as a constant because it is being
|
| + // passed to reflectClass.
|
| + continue;
|
| + }
|
| + Expect.isFalse(
|
| + compiler.constantHandler.compiledConstants.contains(constant),
|
| + '$constant');
|
| + }
|
| +
|
| + // The type literal 'Foo' is both used as metadata, and as a plain value in
|
| + // the program. Make sure that it isn't duplicated.
|
| + int fooConstantCount = 0;
|
| + for (Constant constant in compiler.metadataHandler.compiledConstants) {
|
| + if (constant is TypeConstant && '${constant.representedType}' == 'Foo') {
|
| + fooConstantCount++;
|
| + }
|
| + }
|
| + Expect.equals(
|
| + 1, fooConstantCount, "The type literal 'Foo' is duplicated or missing.");
|
| }
|
|
|
| const MEMORY_SOURCE_FILES = const <String, String> {
|
|
|