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

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

Issue 13019003: Enable full type-checks in checked mode. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. 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 727bcc9f3f35b2eecb651f19dbdfaf9dd749c79d..9cb0df533ed3326500243530a51f4958458f8b83 100644
--- a/sdk/lib/_internal/compiler/implementation/ssa/nodes.dart
+++ b/sdk/lib/_internal/compiler/implementation/ssa/nodes.dart
@@ -1087,6 +1087,9 @@ abstract class HInstruction implements Spannable {
// 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) {
ngeoffray 2013/05/15 08:45:33 Use: } else if { throw... } else { ... } ins
karlklose 2013/05/15 12:59:16 Done.
+ throw 'creating compound check to $type (this = ${this})';
+ }
HType subtype = new HType.subtype(type, compiler);
return new HTypeConversion(type, kind, subtype, this);
}
@@ -2133,7 +2136,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;
@@ -2200,6 +2202,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