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

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

Issue 2895983002: Read SDK and patches from a JSON file. (Closed)
Patch Set: Address comments and fix uses of TranslateUri. Created 3 years, 7 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/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 42d3a59efa81f35d779ece3d562a0f71cce3c456..9701c3545ee7e8290ef24aaa16d1af7811061dee 100644
--- a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
@@ -93,7 +93,7 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
final Scope enclosingScope;
- final bool isDartLibrary;
+ final bool enableNative;
@override
final Uri uri;
@@ -164,7 +164,7 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
{this.fieldDependencies})
: enclosingScope = scope,
library = library,
- isDartLibrary = library.uri.scheme == "dart",
+ enableNative = (library.uri.scheme == "dart" || library.isPatch),
needsImplicitSuperInitializer =
coreTypes.objectClass != classBuilder?.cls,
typePromoter = _typeInferrer.typePromoter,
@@ -888,10 +888,14 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
return new UnresolvedAccessor(this, n, token);
}
return new ThisPropertyAccessor(this, token, n, null, null);
- } else if (isDartLibrary &&
- name == "main" &&
- library.uri.path == "_builtin" &&
- member?.name == "_getMainClosure") {
+ } else if (
+ // Optimization, if [enableNative] is false, this can't be
+ // dart:_builtin.
+ enableNative &&
+ name == "main" &&
+ library.uri.scheme == "dart" &&
+ library.uri.path == "_builtin" &&
+ member?.name == "_getMainClosure") {
// TODO(ahe): https://github.com/dart-lang/sdk/issues/28989
return astFactory.nullLiteral(token);
} else {
@@ -2557,7 +2561,7 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
@override
Token handleUnrecoverableError(Token token, FastaMessage message) {
- if (isDartLibrary && message.code == codeExpectedFunctionBody) {
+ if (enableNative && message.code == codeExpectedFunctionBody) {
Token recover = library.loader.target.skipNativeClause(token);
if (recover != null) return recover;
} else if (message.code == codeExpectedButGot) {

Powered by Google App Engine
This is Rietveld 408576698