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

Unified Diff: sdk/lib/_internal/compiler/implementation/deferred_load.dart

Issue 614993002: Rename Constant to ConstantValue and ConstExp to ConstantExpression. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments. Created 6 years, 3 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
Index: sdk/lib/_internal/compiler/implementation/deferred_load.dart
diff --git a/sdk/lib/_internal/compiler/implementation/deferred_load.dart b/sdk/lib/_internal/compiler/implementation/deferred_load.dart
index daa22957395b1b55732524b8f48fe5104837f099..ec9edd1722fd299f853d3276381ad37f6f02ebbb 100644
--- a/sdk/lib/_internal/compiler/implementation/deferred_load.dart
+++ b/sdk/lib/_internal/compiler/implementation/deferred_load.dart
@@ -6,10 +6,10 @@ library deferred_load;
import 'constants/expressions.dart';
import 'constants/values.dart' show
- Constant,
- ConstructedConstant,
- DeferredConstant,
- StringConstant;
+ ConstantValue,
+ ConstructedConstantValue,
+ DeferredConstantValue,
+ StringConstantValue;
import 'dart2jslib.dart' show
Backend,
@@ -137,8 +137,8 @@ class DeferredLoadTask extends CompilerTask {
/// A mapping from constants to their output unit. Query this via
/// [outputUnitForConstant]
- final Map<Constant, OutputUnit> _constantToOutputUnit =
- new Map<Constant, OutputUnit>();
+ final Map<ConstantValue, OutputUnit> _constantToOutputUnit =
+ new Map<ConstantValue, OutputUnit>();
/// All the imports with a [DeferredLibrary] annotation, mapped to the
/// [LibraryElement] they import.
@@ -149,7 +149,7 @@ class DeferredLoadTask extends CompilerTask {
// For each deferred import we want to know exactly what elements have to
// be loaded.
Map<Import, Set<Element>> _importedDeferredBy = null;
- Map<Import, Set<Constant>> _constantsDeferredBy = null;
+ Map<Import, Set<ConstantValue>> _constantsDeferredBy = null;
Set<Element> _mainElements = new Set<Element>();
@@ -180,7 +180,7 @@ class DeferredLoadTask extends CompilerTask {
}
/// Returns the [OutputUnit] where [constant] belongs.
- OutputUnit outputUnitForConstant(Constant constant) {
+ OutputUnit outputUnitForConstant(ConstantValue constant) {
if (!isProgramSplit) return mainOutputUnit;
return _constantToOutputUnit[constant];
@@ -195,7 +195,7 @@ class DeferredLoadTask extends CompilerTask {
return outputUnitForElement(e1) == outputUnitForElement(e2);
}
- void registerConstantDeferredUse(DeferredConstant constant,
+ void registerConstantDeferredUse(DeferredConstantValue constant,
PrefixElement prefix) {
OutputUnit outputUnit = new OutputUnit();
outputUnit.imports.add(prefix.deferredImport);
@@ -234,14 +234,14 @@ class DeferredLoadTask extends CompilerTask {
void _collectAllElementsAndConstantsResolvedFrom(
Element element,
Set<Element> elements,
- Set<Constant> constants,
+ Set<ConstantValue> constants,
isMirrorUsage) {
/// Recursively add the constant and its dependencies to [constants].
- void addConstants(Constant constant) {
+ void addConstants(ConstantValue constant) {
if (constants.contains(constant)) return;
constants.add(constant);
- if (constant is ConstructedConstant) {
+ if (constant is ConstructedConstantValue) {
elements.add(constant.type.element);
}
constant.getDependencies().forEach(addConstants);
@@ -285,7 +285,8 @@ class DeferredLoadTask extends CompilerTask {
// TODO(sigurdm): How is metadata on a patch-class handled?
for (MetadataAnnotation metadata in element.metadata) {
- ConstExp constant = backend.constants.getConstantForMetadata(metadata);
+ ConstantExpression constant =
+ backend.constants.getConstantForMetadata(metadata);
if (constant != null) {
addConstants(constant.value);
}
@@ -366,8 +367,8 @@ class DeferredLoadTask extends CompilerTask {
{isMirrorUsage: false}) {
Set<Element> elements = _importedDeferredBy.putIfAbsent(import,
() => new Set<Element>());
- Set<Constant> constants = _constantsDeferredBy.putIfAbsent(import,
- () => new Set<Constant>());
+ Set<ConstantValue> constants = _constantsDeferredBy.putIfAbsent(import,
+ () => new Set<ConstantValue>());
// Only process elements once, unless we are doing dependencies due to
// mirrors, which are added in additional traversals.
@@ -421,7 +422,7 @@ class DeferredLoadTask extends CompilerTask {
});
for (MetadataAnnotation metadata in library.metadata) {
- ConstExp constant =
+ ConstantExpression constant =
backend.constants.getConstantForMetadata(metadata);
if (constant != null) {
_mapDependencies(constant.value.computeType(compiler).element,
@@ -430,7 +431,7 @@ class DeferredLoadTask extends CompilerTask {
}
for (LibraryTag tag in library.tags) {
for (MetadataAnnotation metadata in tag.metadata) {
- ConstExp constant =
+ ConstantExpression constant =
backend.constants.getConstantForMetadata(metadata);
if (constant != null) {
_mapDependencies(constant.value.computeType(compiler).element,
@@ -467,11 +468,12 @@ class DeferredLoadTask extends CompilerTask {
assert(metadatas != null);
for (MetadataAnnotation metadata in metadatas) {
metadata.ensureResolved(compiler);
- Element element = metadata.constant.value.computeType(compiler).element;
+ Element element =
+ metadata.constant.value.computeType(compiler).element;
if (element == deferredLibraryClass) {
- ConstructedConstant constant = metadata.constant.value;
- StringConstant s = constant.fields[0];
- result = s.value.slowToString();
+ ConstructedConstantValue constant = metadata.constant.value;
+ StringConstantValue s = constant.fields[0];
+ result = s.primitiveValue.slowToString();
break;
}
}
@@ -531,7 +533,7 @@ class DeferredLoadTask extends CompilerTask {
if (main == null) return;
LibraryElement mainLibrary = main.library;
_importedDeferredBy = new Map<Import, Set<Element>>();
- _constantsDeferredBy = new Map<Import, Set<Constant>>();
+ _constantsDeferredBy = new Map<Import, Set<ConstantValue>>();
_importedDeferredBy[_fakeMainImport] = _mainElements;
measureElement(mainLibrary, () {
@@ -555,8 +557,8 @@ class DeferredLoadTask extends CompilerTask {
// Build the OutputUnits using these two maps.
Map<Element, OutputUnit> elementToOutputUnitBuilder =
new Map<Element, OutputUnit>();
- Map<Constant, OutputUnit> constantToOutputUnitBuilder =
- new Map<Constant, OutputUnit>();
+ Map<ConstantValue, OutputUnit> constantToOutputUnitBuilder =
+ new Map<ConstantValue, OutputUnit>();
// Reverse the mappings. For each element record an OutputUnit collecting
// all deferred imports mapped to this element. Same for constants.
@@ -572,7 +574,7 @@ class DeferredLoadTask extends CompilerTask {
.imports.add(import);
}
}
- for (Constant constant in _constantsDeferredBy[import]) {
+ for (ConstantValue constant in _constantsDeferredBy[import]) {
// Only one file should be loaded when the program starts, so make
// sure that only one OutputUnit is created for [fakeMainImport].
if (import == _fakeMainImport) {
@@ -601,7 +603,7 @@ class DeferredLoadTask extends CompilerTask {
_elementToOutputUnit[element] = representative;
});
constantToOutputUnitBuilder.forEach(
- (Constant constant, OutputUnit outputUnit) {
+ (ConstantValue constant, OutputUnit outputUnit) {
OutputUnit representative = allOutputUnits.lookup(outputUnit);
if (representative == null) {
representative = outputUnit;
@@ -657,7 +659,8 @@ class DeferredLoadTask extends CompilerTask {
Element element =
metadata.constant.value.computeType(compiler).element;
if (element == deferredLibraryClass) {
- compiler.reportFatalError(import, MessageKind.DEFERRED_OLD_SYNTAX);
+ compiler.reportFatalError(
+ import, MessageKind.DEFERRED_OLD_SYNTAX);
}
}
}

Powered by Google App Engine
This is Rietveld 408576698