Index: pkg/compiler/lib/src/js_backend/backend.dart |
diff --git a/pkg/compiler/lib/src/js_backend/backend.dart b/pkg/compiler/lib/src/js_backend/backend.dart |
index 83cab66a099824606efa90f4d95bd27a753a0693..35f6cb8efe4a2525f5719af4baf444f76d30d8f0 100644 |
--- a/pkg/compiler/lib/src/js_backend/backend.dart |
+++ b/pkg/compiler/lib/src/js_backend/backend.dart |
@@ -1474,9 +1474,9 @@ class JavaScriptBackend extends Backend { |
} |
if (kind.category == ElementCategory.VARIABLE) { |
VariableElement variableElement = element; |
- ConstantValue initialValue = |
- constants.getConstantValue(variableElement.constant); |
- if (initialValue != null) { |
+ ConstantExpression constant = variableElement.constant; |
+ if (constant != null) { |
+ ConstantValue initialValue = constants.getConstantValue(constant); |
registerCompileTimeConstant(initialValue, work.registry); |
addCompileTimeConstantForEmission(initialValue); |
// We don't need to generate code for static or top-level |
@@ -1851,7 +1851,9 @@ class JavaScriptBackend extends Backend { |
if (library.isPlatformLibrary && |
// Don't patch library currently disallowed. |
!library.isSynthesized && |
- !library.isPatched) { |
+ !library.isPatched && |
+ // Don't patch deserialized libraries. |
+ !compiler.serialization.isDeserialized(library)) { |
// Apply patch, if any. |
Uri patchUri = compiler.resolvePatchUri(library.canonicalUri.path); |
if (patchUri != null) { |
@@ -2510,6 +2512,11 @@ class JSFrontendAccess implements Frontend { |
return element.resolvedAst; |
} else if (element is ConstructorBodyElementX) { |
return element.resolvedAst; |
+ } else if (element is FieldElementX) { |
+ // TODO(johnniwinther): Find a good invariant for resolution of fields. |
+ // Currently some but not all are resolved (maybe it has to do with |
+ // initializers?) |
+ return element.resolvedAst; |
} else { |
assert(invariant(element, resolution.hasResolvedAst(element.declaration), |
message: 'No ResolvedAst for $element')); |