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

Unified Diff: pkg/front_end/lib/src/fasta/kernel/body_builder.dart

Issue 2931773003: Add flutter mode to patched_sdk (Closed)
Patch Set: address cl comments and merge conflicts Created 3 years, 6 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
« no previous file with comments | « pkg/front_end/lib/src/fasta/dill/dill_loader.dart ('k') | pkg/kernel/lib/target/flutter.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/front_end/lib/src/fasta/kernel/body_builder.dart
diff --git a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
index 959407bfc1f70e6154c0f835c1199fc514072031..3d17400b0046cd784ac662092a11eb7d31bc67db 100644
--- a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
@@ -92,7 +92,17 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
final bool enableNative;
- final bool isBuiltinLibrary;
+ /// Whether to ignore an unresolved reference to `main` within the body of
+ /// `_getMainClosure` when compiling the current library.
+ ///
+ /// This as a temporary workaround. The standalone VM and flutter have
+ /// special logic to resolve `main` in `_getMainClosure`, this flag is used to
+ /// ignore that reference to `main`, but only on libraries where we expect to
+ /// see it (today that is dart:_builtin and dart:ui).
+ ///
+ // TODO(ahe,sigmund): remove when the VM gets rid of the special rule, see
+ // https://github.com/dart-lang/sdk/issues/28989.
+ final bool ignoreMainInGetMainClosure;
@override
final Uri uri;
@@ -169,8 +179,8 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
: enclosingScope = scope,
library = library,
enableNative = library.loader.target.enableNative(library),
- isBuiltinLibrary =
- library.uri.scheme == 'dart' && library.uri.path == "_builtin",
+ ignoreMainInGetMainClosure = library.uri.scheme == 'dart' &&
+ (library.uri.path == "_builtin" || library.uri.path == "ui"),
needsImplicitSuperInitializer =
coreTypes.objectClass != classBuilder?.cls,
typePromoter = _typeInferrer.typePromoter,
@@ -1081,10 +1091,9 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
return new UnresolvedAccessor(this, n, token);
}
return new ThisPropertyAccessor(this, token, n, null, null);
- } else if (isBuiltinLibrary &&
+ } else if (ignoreMainInGetMainClosure &&
name == "main" &&
member?.name == "_getMainClosure") {
- // TODO(ahe): https://github.com/dart-lang/sdk/issues/28989
return new KernelNullLiteral()..fileOffset = offsetForToken(token);
} else {
return new UnresolvedAccessor(this, n, token);
« no previous file with comments | « pkg/front_end/lib/src/fasta/dill/dill_loader.dart ('k') | pkg/kernel/lib/target/flutter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698