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

Unified Diff: lib/compiler/implementation/ssa/codegen.dart

Issue 10540048: Implement 'as' operator. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Make "as" a builtin identifier. Created 8 years, 6 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: lib/compiler/implementation/ssa/codegen.dart
diff --git a/lib/compiler/implementation/ssa/codegen.dart b/lib/compiler/implementation/ssa/codegen.dart
index d8db36171f7cf84273e07f8d41bfb8ab0720bf60..c6fff5391cd2250b04bd3bbc4c4454333b4da193 100644
--- a/lib/compiler/implementation/ssa/codegen.dart
+++ b/lib/compiler/implementation/ssa/codegen.dart
@@ -2235,6 +2235,34 @@ class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor {
}
void visitTypeConversion(HTypeConversion node) {
+ Map<String, SourceString> castNames = const <SourceString> {
+ "stringTypeCheck":
+ const SourceString("stringTypeCast"),
+ "doubleTypeCheck":
+ const SourceString("doubleTypeCast"),
+ "numTypeCheck":
+ const SourceString("numTypeCast"),
+ "boolTypeCheck":
+ const SourceString("boolTypeCast"),
+ "functionTypeCheck":
+ const SourceString("functionTypeCast"),
+ "intTypeCheck":
+ const SourceString("intTypeCast"),
+ "stringSuperNativeTypeCheck":
+ const SourceString("stringSuperNativeTypeCast"),
+ "stringSuperTypeCheck":
+ const SourceString("stringSuperTypeCast"),
+ "listTypeCheck":
+ const SourceString("listTypeCast"),
+ "listSuperNativeTypeCheck":
+ const SourceString("listSuperNativeTypeCast"),
+ "listSuperTypeCheck":
+ const SourceString("listSuperTypeCast"),
+ "callTypeCheck":
+ const SourceString("callTypeCast"),
+ "propertyTypeCheck":
+ const SourceString("propertyTypeCast")
+ };
if (node.checked) {
Element element = node.type.computeType(compiler).element;
world.registerIsCheck(element);
@@ -2278,6 +2306,9 @@ class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor {
helper = const SourceString('propertyTypeCheck');
}
}
+ if (node.isCast) {
+ helper = castNames[helper.stringValue];
+ }
Element helperElement = compiler.findHelper(helper);
world.registerStaticUse(helperElement);
buffer.add(compiler.namer.isolateAccess(helperElement));

Powered by Google App Engine
This is Rietveld 408576698