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

Unified Diff: sdk/lib/_internal/compiler/implementation/js_emitter/metadata_emitter.dart

Issue 574683002: Use ConstExp for storing constants. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Remove ConstExpBuilder. 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/js_emitter/metadata_emitter.dart
diff --git a/sdk/lib/_internal/compiler/implementation/js_emitter/metadata_emitter.dart b/sdk/lib/_internal/compiler/implementation/js_emitter/metadata_emitter.dart
index 1c8cfa46a9149ff604843b987aba7004d00a0a65..0ebaf6fc2e5258986ef0907a60e3251e60ec87fc 100644
--- a/sdk/lib/_internal/compiler/implementation/js_emitter/metadata_emitter.dart
+++ b/sdk/lib/_internal/compiler/implementation/js_emitter/metadata_emitter.dart
@@ -27,12 +27,12 @@ class MetadataEmitter extends CodeEmitterHelper {
if (link != null) {
for (; !link.isEmpty; link = link.tail) {
MetadataAnnotation annotation = link.head;
- Constant value =
+ ConstExp constant =
backend.constants.getConstantForMetadata(annotation);
- if (value == null) {
+ if (constant == null) {
compiler.internalError(annotation, 'Annotation value is null.');
} else {
- metadata.add(task.constantReference(value));
+ metadata.add(task.constantReference(constant.value));
}
}
}
@@ -47,10 +47,10 @@ class MetadataEmitter extends CodeEmitterHelper {
if (signature.optionalParameterCount == 0) return const [];
List<int> defaultValues = <int>[];
for (Element element in signature.optionalParameters) {
- Constant value = backend.constants.getConstantForVariable(element);
- String stringRepresentation = (value == null)
+ ConstExp constant = backend.constants.getConstantForVariable(element);
+ String stringRepresentation = (constant == null)
? "null"
- : jsAst.prettyPrint(task.constantReference(value), compiler)
+ : jsAst.prettyPrint(task.constantReference(constant.value), compiler)
.getText();
defaultValues.add(addGlobalMetadata(stringRepresentation));
}
@@ -58,13 +58,14 @@ class MetadataEmitter extends CodeEmitterHelper {
}
int reifyMetadata(MetadataAnnotation annotation) {
- Constant value = backend.constants.getConstantForMetadata(annotation);
- if (value == null) {
+ ConstExp constant = backend.constants.getConstantForMetadata(annotation);
+ if (constant == null) {
compiler.internalError(annotation, 'Annotation value is null.');
return -1;
}
return addGlobalMetadata(
- jsAst.prettyPrint(task.constantReference(value), compiler).getText());
+ jsAst.prettyPrint(
+ task.constantReference(constant.value), compiler).getText());
}
int reifyType(DartType type) {

Powered by Google App Engine
This is Rietveld 408576698