Chromium Code Reviews| 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 08211e9a64dbe5fbddaebff2da66286607f3ff04..2dc090cad575016c9f1fc66e57656689dfcadaea 100644 |
| --- a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart |
| +++ b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart |
| @@ -83,7 +83,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; |
|
Siggi Cherem (dart-lang)
2017/06/08 22:18:53
Peter - I don't think it is worth moving this into
ahe
2017/06/09 09:23:35
Agreed.
|
| @override |
| final Uri uri; |
| @@ -160,8 +170,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, |
| @@ -967,10 +977,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); |