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

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: Merged with 1333f97b9a0e3805f991578ef83b0ec4553ecf33 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 cb1c09b6b3e6d6c1f19f7fc3aaefe4c3064e9c5d..a9bf21ef3f9d2f0b26b8040ab019023be09cf853 100644
--- a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
@@ -85,7 +85,7 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
final Scope enclosingScope;
- final bool isDartLibrary;
+ final bool enableNative;
@override
final Uri uri;
@@ -152,7 +152,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,
@@ -875,10 +875,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 new KernelNullLiteral()..fileOffset = offsetForToken(token);
} else {
@@ -2567,7 +2571,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) {
« no previous file with comments | « pkg/front_end/lib/src/fasta/fasta.dart ('k') | pkg/front_end/lib/src/fasta/kernel/kernel_library_builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698