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

Unified Diff: pkg/compiler/lib/src/types/constants.dart

Issue 2585223002: Access ConstantSystem through ClosedWorld. (Closed)
Patch Set: 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/ssa/value_range_analyzer.dart ('k') | pkg/compiler/lib/src/world.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/types/constants.dart
diff --git a/pkg/compiler/lib/src/types/constants.dart b/pkg/compiler/lib/src/types/constants.dart
index 6e4407df989740aad94b0ff2737975df3b085c5a..c6cc7b864fdef1bd70d4637c4f30daa30d9200e8 100644
--- a/pkg/compiler/lib/src/types/constants.dart
+++ b/pkg/compiler/lib/src/types/constants.dart
@@ -14,22 +14,18 @@ import '../world.dart' show ClosedWorld;
import 'masks.dart';
/// Computes the [TypeMask] for the constant [value].
-// TODO(johnniwinther): Avoid the need for [backend].
-TypeMask computeTypeMask(
- ClosedWorld closedWorld, JavaScriptBackend backend, ConstantValue value) {
- return value.accept(new ConstantValueTypeMasks(backend), closedWorld);
+TypeMask computeTypeMask(ClosedWorld closedWorld, ConstantValue value) {
+ return value.accept(const ConstantValueTypeMasks(), closedWorld);
}
class ConstantValueTypeMasks
extends ConstantValueVisitor<TypeMask, ClosedWorld> {
- final JavaScriptBackend backend;
-
- ConstantValueTypeMasks(this.backend);
+ const ConstantValueTypeMasks();
@override
TypeMask visitConstructed(
ConstructedConstantValue constant, ClosedWorld closedWorld) {
- if (backend.isInterceptorClass(constant.type.element)) {
+ if (closedWorld.backendClasses.isInterceptorClass(constant.type.element)) {
return closedWorld.commonMasks.nonNullType;
}
return new TypeMask.nonNullExact(constant.type.element, closedWorld);
@@ -44,7 +40,7 @@ class ConstantValueTypeMasks
@override
TypeMask visitDouble(DoubleConstantValue constant, ClosedWorld closedWorld) {
// We have to recognize double constants that are 'is int'.
- if (backend.constantSystem.isInt(constant)) {
+ if (closedWorld.constantSystem.isInt(constant)) {
if (constant.isMinusZero) {
return closedWorld.commonMasks.uint31Type;
} else {
@@ -68,10 +64,8 @@ class ConstantValueTypeMasks
case SyntheticConstantKind.NAME:
return closedWorld.commonMasks.stringType;
default:
- DiagnosticReporter reporter = backend.reporter;
- reporter.internalError(
- CURRENT_ELEMENT_SPANNABLE, "Unexpected DummyConstantKind.");
- return null;
+ throw new SpannableAssertionFailure(CURRENT_ELEMENT_SPANNABLE,
Siggi Cherem (dart-lang) 2016/12/20 00:58:40 Is this a good general direction to think about? (
Johnni Winther 2016/12/20 08:35:48 The only difference is whether the stack-trace is
+ "Unexpected DummyConstantKind: ${constant.toStructuredText()}.");
}
}
« no previous file with comments | « pkg/compiler/lib/src/ssa/value_range_analyzer.dart ('k') | pkg/compiler/lib/src/world.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698