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

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

Issue 15563003: Add the cast equivalent of assertSubtype and assertSubtypeOfRuntimeType. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: 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/builder.dart
===================================================================
--- sdk/lib/_internal/compiler/implementation/ssa/builder.dart (revision 22932)
+++ sdk/lib/_internal/compiler/implementation/ssa/builder.dart (working copy)
@@ -1827,14 +1827,12 @@
}
}
- HInstruction buildTypeConversion(Compiler compiler, HInstruction original,
- DartType type, int kind) {
+ HInstruction buildTypeConversion(HInstruction original,
+ DartType type,
+ int kind) {
if (type == null) return original;
if (type.kind == TypeKind.INTERFACE && !type.isMalformed && !type.isRaw) {
HType subtype = new HType.subtype(type, compiler);
- if (type.isRaw) {
- return new HTypeConversion(type, kind, subtype, original);
- }
HInstruction representations = buildTypeArgumentRepresentations(type);
add(representations);
return new HTypeConversion.withTypeRepresentation(type, kind, subtype,
@@ -1852,8 +1850,7 @@
HInstruction potentiallyCheckType(HInstruction original, DartType type,
{ int kind: HTypeConversion.CHECKED_MODE_CHECK }) {
if (!compiler.enableTypeAssertions) return original;
- HInstruction other =
- buildTypeConversion(compiler, original, type, kind);
+ HInstruction other = buildTypeConversion(original, type, kind);
if (other != original) add(other);
return other;
}
@@ -2798,8 +2795,8 @@
Node argument = node.arguments.head;
TypeAnnotation typeAnnotation = argument.asTypeAnnotation();
DartType type = elements.getType(typeAnnotation);
- HInstruction converted = expression.convertType(
- compiler, type, HTypeConversion.CAST_TYPE_CHECK);
+ HInstruction converted = buildTypeConversion(
+ expression, type, HTypeConversion.CAST_TYPE_CHECK);
if (converted != expression) add(converted);
stack.add(converted);
} else {
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/lib/js_rti.dart ('k') | sdk/lib/_internal/compiler/implementation/ssa/nodes.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698