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

Unified Diff: pkg/front_end/lib/src/fasta/source/source_loader.dart

Issue 2979463002: Revert "Tweak public APIs and use them in patch_sdk, dart2js, and kernel-service." (Closed)
Patch Set: Created 3 years, 5 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/source/source_loader.dart
diff --git a/pkg/front_end/lib/src/fasta/source/source_loader.dart b/pkg/front_end/lib/src/fasta/source/source_loader.dart
index 1764e5b2bb3e2c31bac01a94fdfcff617e325faa..1fd040e8fd65bab027d91cfd29c914405578b160 100644
--- a/pkg/front_end/lib/src/fasta/source/source_loader.dart
+++ b/pkg/front_end/lib/src/fasta/source/source_loader.dart
@@ -339,6 +339,14 @@ class SourceLoader<L> extends Loader<L> {
return output;
}
+ /// Whether [library] is allowed to define classes that extend or implement
+ /// restricted types, such as `bool`, `int`, `double`, `num`, and `String`. By
+ /// default this is only allowed within the implementation of `dart:core`, but
+ /// some target implementations may need to override this to allow doing this
+ /// in other internal platform libraries.
+ bool canImplementRestrictedTypes(LibraryBuilder library) =>
+ library == coreLibrary;
+
void checkSemantics() {
List<ClassBuilder> allClasses = target.collectAllClasses();
Iterable<ClassBuilder> candidates = cyclicCandidates(allClasses);
@@ -387,7 +395,7 @@ class SourceLoader<L> extends Loader<L> {
cls.charOffset,
"'${supertype.name}' is an enum and can't be extended or "
"implemented.");
- } else if (!cls.library.mayImplementRestrictedTypes &&
+ } else if (!canImplementRestrictedTypes(cls.library) &&
blackListedClasses.contains(supertype)) {
cls.addCompileTimeError(
cls.charOffset,
« no previous file with comments | « pkg/front_end/lib/src/fasta/source/outline_builder.dart ('k') | pkg/front_end/lib/src/fasta/target_implementation.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698