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

Unified Diff: pkg/compiler/lib/src/js_backend/backend.dart

Issue 1927963002: Support compilation of Hello World (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Fixes Created 4 years, 8 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: 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'));

Powered by Google App Engine
This is Rietveld 408576698