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

Unified Diff: sdk/lib/_internal/compiler/implementation/ssa/nodes.dart

Issue 15299002: Reapply "Enable full type-checks in checked mode." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Update test expectations. Created 7 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: sdk/lib/_internal/compiler/implementation/ssa/nodes.dart
diff --git a/sdk/lib/_internal/compiler/implementation/ssa/nodes.dart b/sdk/lib/_internal/compiler/implementation/ssa/nodes.dart
index 89be18055f4cd9ae13848700598f4035227cb020..2eb8faa652971dd10d0ce8635695b03d76c3482f 100644
--- a/sdk/lib/_internal/compiler/implementation/ssa/nodes.dart
+++ b/sdk/lib/_internal/compiler/implementation/ssa/nodes.dart
@@ -1090,6 +1090,8 @@ abstract class HInstruction implements Spannable {
} else if (kind == HTypeConversion.BOOLEAN_CONVERSION_CHECK) {
// Boolean conversion checks work on non-nullable booleans.
return new HTypeConversion(type, kind, HType.BOOLEAN, this);
+ } else if (kind == HTypeConversion.CHECKED_MODE_CHECK && !type.isRaw) {
+ throw 'creating compound check to $type (this = ${this})';
} else {
HType subtype = new HType.subtype(type, compiler);
return new HTypeConversion(type, kind, subtype, this);
@@ -2155,7 +2157,6 @@ class HIndexAssign extends HInstruction {
HInstruction get value => inputs[2];
}
-// TODO(karlklose): use this class to represent type conversions as well.
class HIs extends HInstruction {
/// A check against a raw type: 'o is int', 'o is A'.
static const int RAW_CHECK = 0;
@@ -2222,6 +2223,23 @@ class HTypeConversion extends HCheck {
instructionType = type;
}
+ HTypeConversion.withTypeRepresentation(this.typeExpression, this.kind,
+ HType type, HInstruction input,
+ HInstruction typeRepresentation)
+ : super(<HInstruction>[input, typeRepresentation]),
+ receiverTypeCheckSelector = null {
+ sourceElement = input.sourceElement;
+ instructionType = type;
+ }
+
+ bool get hasTypeRepresentation => inputs.length > 1;
+ HInstruction get typeRepresentation => inputs[1];
+
+ HInstruction convertType(Compiler compiler, DartType type, int kind) {
+ if (typeExpression == type) return this;
+ return super.convertType(compiler, type, kind);
+ }
+
bool get isChecked => kind != NO_CHECK;
bool get isCheckedModeCheck {
return kind == CHECKED_MODE_CHECK

Powered by Google App Engine
This is Rietveld 408576698