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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/js_backend/backend.dart

Issue 12047040: Return correct helper for malformed type checks. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add a comment. Created 7 years, 11 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of js_backend; 5 part of js_backend;
6 6
7 typedef void Recompile(Element element); 7 typedef void Recompile(Element element);
8 8
9 class ReturnInfo { 9 class ReturnInfo {
10 HType returnType; 10 HType returnType;
(...skipping 1085 matching lines...) Expand 10 before | Expand all | Expand 10 after
1096 } 1096 }
1097 1097
1098 HType optimisticFieldType(Element element) { 1098 HType optimisticFieldType(Element element) {
1099 return fieldTypes.optimisticFieldType(element); 1099 return fieldTypes.optimisticFieldType(element);
1100 } 1100 }
1101 1101
1102 SourceString getCheckedModeHelper(DartType type) { 1102 SourceString getCheckedModeHelper(DartType type) {
1103 Element element = type.element; 1103 Element element = type.element;
1104 bool nativeCheck = 1104 bool nativeCheck =
1105 emitter.nativeEmitter.requiresNativeIsCheck(element); 1105 emitter.nativeEmitter.requiresNativeIsCheck(element);
1106 if (type == compiler.types.voidType) { 1106 if (type.isMalformed) {
1107 // Check for malformed types first, because the type may be a list type
1108 // with a malformed argument type.
1109 return const SourceString('malformedTypeCheck');
1110 } else if (type == compiler.types.voidType) {
1107 return const SourceString('voidTypeCheck'); 1111 return const SourceString('voidTypeCheck');
1108 } else if (element == compiler.stringClass) { 1112 } else if (element == compiler.stringClass) {
1109 return const SourceString('stringTypeCheck'); 1113 return const SourceString('stringTypeCheck');
1110 } else if (element == compiler.doubleClass) { 1114 } else if (element == compiler.doubleClass) {
1111 return const SourceString('doubleTypeCheck'); 1115 return const SourceString('doubleTypeCheck');
1112 } else if (element == compiler.numClass) { 1116 } else if (element == compiler.numClass) {
1113 return const SourceString('numTypeCheck'); 1117 return const SourceString('numTypeCheck');
1114 } else if (element == compiler.boolClass) { 1118 } else if (element == compiler.boolClass) {
1115 return const SourceString('boolTypeCheck'); 1119 return const SourceString('boolTypeCheck');
1116 } else if (element == compiler.functionClass) { 1120 } else if (element == compiler.functionClass) {
1117 return const SourceString('functionTypeCheck'); 1121 return const SourceString('functionTypeCheck');
1118 } else if (element == compiler.intClass) { 1122 } else if (element == compiler.intClass) {
1119 return const SourceString('intTypeCheck'); 1123 return const SourceString('intTypeCheck');
1120 } else if (Elements.isNumberOrStringSupertype(element, compiler)) { 1124 } else if (Elements.isNumberOrStringSupertype(element, compiler)) {
1121 return nativeCheck 1125 return nativeCheck
1122 ? const SourceString('numberOrStringSuperNativeTypeCheck') 1126 ? const SourceString('numberOrStringSuperNativeTypeCheck')
1123 : const SourceString('numberOrStringSuperTypeCheck'); 1127 : const SourceString('numberOrStringSuperTypeCheck');
1124 } else if (Elements.isStringOnlySupertype(element, compiler)) { 1128 } else if (Elements.isStringOnlySupertype(element, compiler)) {
1125 return nativeCheck 1129 return nativeCheck
1126 ? const SourceString('stringSuperNativeTypeCheck') 1130 ? const SourceString('stringSuperNativeTypeCheck')
1127 : const SourceString('stringSuperTypeCheck'); 1131 : const SourceString('stringSuperTypeCheck');
1128 } else if (identical(element, compiler.listClass)) { 1132 } else if (identical(element, compiler.listClass)) {
1129 return const SourceString('listTypeCheck'); 1133 return const SourceString('listTypeCheck');
1130 } else if (type.isMalformed) {
1131 return const SourceString('malformedTypeCheck');
1132 } else { 1134 } else {
1133 if (Elements.isListSupertype(element, compiler)) { 1135 if (Elements.isListSupertype(element, compiler)) {
1134 return nativeCheck 1136 return nativeCheck
1135 ? const SourceString('listSuperNativeTypeCheck') 1137 ? const SourceString('listSuperNativeTypeCheck')
1136 : const SourceString('listSuperTypeCheck'); 1138 : const SourceString('listSuperTypeCheck');
1137 } else { 1139 } else {
1138 return nativeCheck 1140 return nativeCheck
1139 ? const SourceString('callTypeCheck') 1141 ? const SourceString('callTypeCheck')
1140 : const SourceString('propertyTypeCheck'); 1142 : const SourceString('propertyTypeCheck');
1141 } 1143 }
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
1188 } 1190 }
1189 1191
1190 Element getSetRuntimeTypeInfo() { 1192 Element getSetRuntimeTypeInfo() {
1191 return compiler.findHelper(const SourceString('setRuntimeTypeInfo')); 1193 return compiler.findHelper(const SourceString('setRuntimeTypeInfo'));
1192 } 1194 }
1193 1195
1194 Element getGetRuntimeTypeInfo() { 1196 Element getGetRuntimeTypeInfo() {
1195 return compiler.findHelper(const SourceString('getRuntimeTypeInfo')); 1197 return compiler.findHelper(const SourceString('getRuntimeTypeInfo'));
1196 } 1198 }
1197 } 1199 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698