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

Unified Diff: pkg/compiler/lib/src/inferrer/type_graph_nodes.dart

Issue 2488353004: Remove Compiler access from ResolutionEnqueuer (Closed)
Patch Set: Updated cf. comments. Created 4 years, 1 month 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/enqueue.dart ('k') | pkg/compiler/lib/src/js_backend/backend.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/inferrer/type_graph_nodes.dart
diff --git a/pkg/compiler/lib/src/inferrer/type_graph_nodes.dart b/pkg/compiler/lib/src/inferrer/type_graph_nodes.dart
index ddca26254a4baf0e582b5f8586a2d8175fed56b1..7e3bbd6327a33ff18ff7ec0c69caf249edbee01d 100644
--- a/pkg/compiler/lib/src/inferrer/type_graph_nodes.dart
+++ b/pkg/compiler/lib/src/inferrer/type_graph_nodes.dart
@@ -12,6 +12,7 @@ import '../compiler.dart' show Compiler;
import '../constants/values.dart';
import '../dart_types.dart' show DartType, FunctionType, TypeKind;
import '../elements/elements.dart';
+import '../js_backend/backend.dart';
import '../tree/dartstring.dart' show DartString;
import '../tree/tree.dart' as ast show Node, LiteralBool, Send;
import '../types/masks.dart'
@@ -521,13 +522,13 @@ class MemberTypeInformation extends ElementTypeInformation
return mask;
}
if (element.isField) {
- return _narrowType(compiler, mask, element.type);
+ return _narrowType(compiler.closedWorld, mask, element.type);
}
assert(
element.isFunction || element.isGetter || element.isFactoryConstructor);
FunctionType type = element.type;
- return _narrowType(compiler, mask, type.returnType);
+ return _narrowType(compiler.closedWorld, mask, type.returnType);
}
TypeMask computeType(TypeGraphInferrerEngine inferrer) {
@@ -668,7 +669,7 @@ class ParameterTypeInformation extends ElementTypeInformation {
// ignore type annotations to ensure that the checks are actually inserted
// into the function body and retained until runtime.
assert(!compiler.options.enableTypeAssertions);
- return _narrowType(compiler, mask, element.type);
+ return _narrowType(compiler.closedWorld, mask, element.type);
}
TypeMask computeType(TypeGraphInferrerEngine inferrer) {
@@ -970,9 +971,10 @@ class DynamicCallSiteTypeInformation extends CallSiteTypeInformation {
inferrer.updateSelectorInTree(caller, call, selector, typeMask);
Compiler compiler = inferrer.compiler;
+ JavaScriptBackend backend = compiler.backend;
TypeMask maskToUse =
compiler.closedWorld.extendMaskIfReachesAll(selector, typeMask);
- bool canReachAll = compiler.enabledInvokeOn && (maskToUse != typeMask);
+ bool canReachAll = backend.hasInvokeOnSupport && (maskToUse != typeMask);
// If this call could potentially reach all methods that satisfy
// the untyped selector (through noSuchMethod's `Invocation`
@@ -1724,24 +1726,24 @@ abstract class TypeInformationVisitor<T> {
T visitAwaitTypeInformation(AwaitTypeInformation info);
}
-TypeMask _narrowType(Compiler compiler, TypeMask type, DartType annotation,
+TypeMask _narrowType(
+ ClosedWorld closedWorld, TypeMask type, DartType annotation,
{bool isNullable: true}) {
if (annotation.treatAsDynamic) return type;
if (annotation.isObject) return type;
TypeMask otherType;
if (annotation.isTypedef || annotation.isFunctionType) {
- otherType = compiler.commonMasks.functionType;
+ otherType = closedWorld.commonMasks.functionType;
} else if (annotation.isTypeVariable) {
// TODO(ngeoffray): Narrow to bound.
return type;
} else if (annotation.isVoid) {
- otherType = compiler.commonMasks.nullType;
+ otherType = closedWorld.commonMasks.nullType;
} else {
assert(annotation.isInterfaceType);
- otherType =
- new TypeMask.nonNullSubtype(annotation.element, compiler.closedWorld);
+ otherType = new TypeMask.nonNullSubtype(annotation.element, closedWorld);
}
if (isNullable) otherType = otherType.nullable();
if (type == null) return otherType;
- return type.intersection(otherType, compiler.closedWorld);
+ return type.intersection(otherType, closedWorld);
}
« no previous file with comments | « pkg/compiler/lib/src/enqueue.dart ('k') | pkg/compiler/lib/src/js_backend/backend.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698