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

Unified Diff: pkg/compiler/lib/src/elements/elements.dart

Issue 2569733002: Even less reliance on Compiler.closedWorld (Closed)
Patch Set: Updated cf. comments. Created 4 years 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/compiler/lib/src/dump_info.dart ('k') | pkg/compiler/lib/src/inferrer/inferrer_visitor.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/elements/elements.dart
diff --git a/pkg/compiler/lib/src/elements/elements.dart b/pkg/compiler/lib/src/elements/elements.dart
index 66eec37b0622ea31246e1db97a60f26a3c1b5b98..9fef6879146d974254a1602b439d3a7fa40fe738 100644
--- a/pkg/compiler/lib/src/elements/elements.dart
+++ b/pkg/compiler/lib/src/elements/elements.dart
@@ -9,7 +9,7 @@ import '../common/resolution.dart' show Resolution;
import '../compiler.dart' show Compiler;
import '../constants/constructors.dart';
import '../constants/expressions.dart';
-import '../core_types.dart' show CoreClasses;
+import '../core_types.dart' show CoreClasses, CommonElements;
import '../dart_types.dart';
import '../ordered_typeset.dart' show OrderedTypeSet;
import '../resolution/scope.dart' show Scope;
@@ -20,6 +20,7 @@ import '../tokens/token.dart'
import '../tree/tree.dart';
import '../util/characters.dart' show $_;
import '../util/util.dart';
+import '../world.dart' show ClosedWorld;
import 'entities.dart';
import 'visitor.dart' show ElementVisitor;
@@ -675,18 +676,20 @@ class Elements {
return null;
}
- static bool isNumberOrStringSupertype(Element element, Compiler compiler) {
- LibraryElement coreLibrary = compiler.commonElements.coreLibrary;
+ static bool isNumberOrStringSupertype(
+ Element element, CommonElements commonElements) {
+ LibraryElement coreLibrary = commonElements.coreLibrary;
return (element == coreLibrary.find('Comparable'));
}
- static bool isStringOnlySupertype(Element element, Compiler compiler) {
- LibraryElement coreLibrary = compiler.commonElements.coreLibrary;
+ static bool isStringOnlySupertype(
+ Element element, CommonElements commonElements) {
+ LibraryElement coreLibrary = commonElements.coreLibrary;
return element == coreLibrary.find('Pattern');
}
- static bool isListSupertype(Element element, Compiler compiler) {
- LibraryElement coreLibrary = compiler.commonElements.coreLibrary;
+ static bool isListSupertype(Element element, CommonElements commonElements) {
+ LibraryElement coreLibrary = commonElements.coreLibrary;
return element == coreLibrary.find('Iterable');
}
@@ -770,23 +773,23 @@ class Elements {
}
static bool isFixedListConstructorCall(
- Element element, Send node, Compiler compiler) {
- return element == compiler.unnamedListConstructor &&
+ Element element, Send node, CommonElements commonElements) {
+ return element == commonElements.unnamedListConstructor &&
node.isCall &&
!node.arguments.isEmpty &&
node.arguments.tail.isEmpty;
}
static bool isGrowableListConstructorCall(
- Element element, Send node, Compiler compiler) {
- return element == compiler.unnamedListConstructor &&
+ Element element, Send node, CommonElements commonElements) {
+ return element == commonElements.unnamedListConstructor &&
node.isCall &&
node.arguments.isEmpty;
}
static bool isFilledListConstructorCall(
- Element element, Send node, Compiler compiler) {
- return element == compiler.filledListConstructor &&
+ Element element, Send node, CommonElements commonElements) {
+ return element == commonElements.filledListConstructor &&
node.isCall &&
!node.arguments.isEmpty &&
!node.arguments.tail.isEmpty &&
@@ -794,17 +797,17 @@ class Elements {
}
static bool isConstructorOfTypedArraySubclass(
- Element element, Compiler compiler) {
- if (compiler.commonElements.typedDataLibrary == null) return false;
+ Element element, ClosedWorld closedWorld) {
+ if (closedWorld.commonElements.typedDataLibrary == null) return false;
if (!element.isConstructor) return false;
ConstructorElement constructor = element.implementation;
constructor = constructor.effectiveTarget;
ClassElement cls = constructor.enclosingClass;
- return cls.library == compiler.commonElements.typedDataLibrary &&
- compiler.backend.isNative(cls) &&
- compiler.closedWorld
- .isSubtypeOf(cls, compiler.commonElements.typedDataClass) &&
- compiler.closedWorld.isSubtypeOf(cls, compiler.coreClasses.listClass) &&
+ return cls.library == closedWorld.commonElements.typedDataLibrary &&
+ closedWorld.backendClasses.isNative(cls) &&
+ closedWorld.isSubtypeOf(
+ cls, closedWorld.commonElements.typedDataClass) &&
+ closedWorld.isSubtypeOf(cls, closedWorld.coreClasses.listClass) &&
constructor.name == '';
}
« no previous file with comments | « pkg/compiler/lib/src/dump_info.dart ('k') | pkg/compiler/lib/src/inferrer/inferrer_visitor.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698