| Index: sdk/lib/_internal/compiler/implementation/mirrors_used.dart
|
| diff --git a/sdk/lib/_internal/compiler/implementation/mirrors_used.dart b/sdk/lib/_internal/compiler/implementation/mirrors_used.dart
|
| index f40714dc403989a894e46cc8af2e41c3a5490a7b..208904edeb8b8e7ddec86332d5eae1a27ef3f694 100644
|
| --- a/sdk/lib/_internal/compiler/implementation/mirrors_used.dart
|
| +++ b/sdk/lib/_internal/compiler/implementation/mirrors_used.dart
|
| @@ -6,11 +6,11 @@ library dart2js.mirrors_used;
|
|
|
| import 'constants/expressions.dart';
|
| import 'constants/values.dart' show
|
| - Constant,
|
| - ConstructedConstant,
|
| - ListConstant,
|
| - StringConstant,
|
| - TypeConstant;
|
| + ConstantValue,
|
| + ConstructedConstantValue,
|
| + ListConstantValue,
|
| + StringConstantValue,
|
| + TypeConstantValue;
|
|
|
| import 'dart_types.dart' show
|
| DartType,
|
| @@ -135,7 +135,7 @@ class MirrorUsageAnalyzerTask extends CompilerTask {
|
| NamedArgument named = argument.asNamedArgument();
|
| if (named == null) continue;
|
| ConstantCompiler constantCompiler = compiler.resolver.constantCompiler;
|
| - Constant value =
|
| + ConstantValue value =
|
| constantCompiler.compileNode(named.expression, mapping).value;
|
|
|
| MirrorUsageBuilder builder =
|
| @@ -165,15 +165,15 @@ class MirrorUsageAnalyzer {
|
| final MirrorUsageAnalyzerTask task;
|
| List<LibraryElement> wildcard;
|
| final Set<LibraryElement> librariesWithUsage;
|
| - final Map<Constant, List<String>> cachedStrings;
|
| - final Map<Constant, List<Element>> cachedElements;
|
| + final Map<ConstantValue, List<String>> cachedStrings;
|
| + final Map<ConstantValue, List<Element>> cachedElements;
|
| MirrorUsage mergedMirrorUsage;
|
|
|
| MirrorUsageAnalyzer(Compiler compiler, this.task)
|
| : compiler = compiler,
|
| librariesWithUsage = new Set<LibraryElement>(),
|
| - cachedStrings = new Map<Constant, List<String>>(),
|
| - cachedElements = new Map<Constant, List<Element>>();
|
| + cachedStrings = new Map<ConstantValue, List<String>>(),
|
| + cachedElements = new Map<ConstantValue, List<Element>>();
|
|
|
| /// Collect and merge all @MirrorsUsed annotations. As a side-effect, also
|
| /// compute which libraries have the annotation (which is used by
|
| @@ -326,8 +326,8 @@ class MirrorUsageAnalyzer {
|
|
|
| /// Convert a [constant] to an instance of [MirrorUsage] using information
|
| /// that was resolved during [MirrorUsageAnalyzerTask.validate].
|
| - MirrorUsage buildUsage(ConstructedConstant constant) {
|
| - Map<Element, Constant> fields = constant.fieldElements;
|
| + MirrorUsage buildUsage(ConstructedConstantValue constant) {
|
| + Map<Element, ConstantValue> fields = constant.fieldElements;
|
| VariableElement symbolsField = compiler.mirrorsUsedClass.lookupLocalMember(
|
| 'symbols');
|
| VariableElement targetsField = compiler.mirrorsUsedClass.lookupLocalMember(
|
| @@ -371,7 +371,7 @@ class MirrorUsageBuilder {
|
| final MirrorUsageAnalyzer analyzer;
|
| final LibraryElement enclosingLibrary;
|
| final Spannable spannable;
|
| - final Constant constant;
|
| + final ConstantValue constant;
|
| final TreeElements elements;
|
|
|
| MirrorUsageBuilder(
|
| @@ -392,18 +392,18 @@ class MirrorUsageBuilder {
|
| /// [Type] values are treated as an error (meaning that the value is ignored
|
| /// and a hint is emitted).
|
| List convertConstantToUsageList(
|
| - Constant constant, { bool onlyStrings: false }) {
|
| + ConstantValue constant, { bool onlyStrings: false }) {
|
| if (constant.isNull) {
|
| return null;
|
| } else if (constant.isList) {
|
| - ListConstant list = constant;
|
| + ListConstantValue list = constant;
|
| List result = onlyStrings ? <String> [] : [];
|
| - for (Constant entry in list.entries) {
|
| + for (ConstantValue entry in list.entries) {
|
| if (entry.isString) {
|
| - StringConstant string = entry;
|
| - result.add(string.value.slowToString());
|
| + StringConstantValue string = entry;
|
| + result.add(string.primitiveValue.slowToString());
|
| } else if (!onlyStrings && entry.isType) {
|
| - TypeConstant type = entry;
|
| + TypeConstantValue type = entry;
|
| result.add(type.representedType);
|
| } else {
|
| Spannable node = positionOf(entry);
|
| @@ -417,12 +417,12 @@ class MirrorUsageBuilder {
|
| }
|
| return result;
|
| } else if (!onlyStrings && constant.isType) {
|
| - TypeConstant type = constant;
|
| + TypeConstantValue type = constant;
|
| return [type.representedType];
|
| } else if (constant.isString) {
|
| - StringConstant string = constant;
|
| + StringConstantValue string = constant;
|
| var iterable =
|
| - string.value.slowToString().split(',').map((e) => e.trim());
|
| + string.primitiveValue.slowToString().split(',').map((e) => e.trim());
|
| return onlyStrings ? new List<String>.from(iterable) : iterable.toList();
|
| } else {
|
| Spannable node = positionOf(constant);
|
| @@ -437,7 +437,7 @@ class MirrorUsageBuilder {
|
| }
|
|
|
| /// Find the first non-implementation interface of constant.
|
| - DartType apiTypeOf(Constant constant) {
|
| + DartType apiTypeOf(ConstantValue constant) {
|
| DartType type = constant.computeType(compiler);
|
| LibraryElement library = type.element.library;
|
| if (type.isInterfaceType && library.isInternalLibrary) {
|
| @@ -563,9 +563,9 @@ class MirrorUsageBuilder {
|
| }
|
|
|
| /// Attempt to find a [Spannable] corresponding to constant.
|
| - Spannable positionOf(Constant constant) {
|
| + Spannable positionOf(ConstantValue constant) {
|
| Node node;
|
| - elements.forEachConstantNode((Node n, ConstExp c) {
|
| + elements.forEachConstantNode((Node n, ConstantExpression c) {
|
| if (node == null && c.value == constant) {
|
| node = n;
|
| }
|
|
|