| OLD | NEW |
| 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 #library('dart:_js_helper'); | 5 #library('dart:_js_helper'); |
| 6 | 6 |
| 7 #import('coreimpl.dart'); | 7 #import('coreimpl.dart'); |
| 8 | 8 |
| 9 #source('constant_map.dart'); | 9 #source('constant_map.dart'); |
| 10 #source('native_helper.dart'); | 10 #source('native_helper.dart'); |
| (...skipping 1095 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1106 callTypeCast(value, property) { | 1106 callTypeCast(value, property) { |
| 1107 if (value === null | 1107 if (value === null |
| 1108 || ((JS('bool', 'typeof # === "object"', value)) | 1108 || ((JS('bool', 'typeof # === "object"', value)) |
| 1109 && JS('bool', '#[#]()', value, property))) { | 1109 && JS('bool', '#[#]()', value, property))) { |
| 1110 return value; | 1110 return value; |
| 1111 } | 1111 } |
| 1112 propertyTypeCastError(value, property); | 1112 propertyTypeCastError(value, property); |
| 1113 } | 1113 } |
| 1114 | 1114 |
| 1115 /** | 1115 /** |
| 1116 * Specialization of the type check for num and String and their |
| 1117 * supertype since [value] can be a JS primitive. |
| 1118 */ |
| 1119 numberOrStringSuperTypeCheck(value, property) { |
| 1120 if (value === null) return value; |
| 1121 if (value is String) return value; |
| 1122 if (value is num) return value; |
| 1123 if (JS('bool', '!!#[#]', value, property)) return value; |
| 1124 propertyTypeError(value, property); |
| 1125 } |
| 1126 |
| 1127 numberOrStringSuperTypeCast(value, property) { |
| 1128 if (value is String) return value; |
| 1129 if (value is num) return value; |
| 1130 return propertyTypeCast(value, property); |
| 1131 } |
| 1132 |
| 1133 numberOrStringSuperNativeTypeCheck(value, property) { |
| 1134 if (value === null) return value; |
| 1135 if (value is String) return value; |
| 1136 if (value is num) return value; |
| 1137 if (JS('bool', '#[#]()', value, property)) return value; |
| 1138 propertyTypeError(value, property); |
| 1139 } |
| 1140 |
| 1141 numberOrStringSuperNativeTypeCast(value, property) { |
| 1142 if (value === null) return value; |
| 1143 if (value is String) return value; |
| 1144 if (value is num) return value; |
| 1145 if (JS('bool', '#[#]()', value, property)) return value; |
| 1146 propertyTypeCastError(value, property); |
| 1147 } |
| 1148 |
| 1149 /** |
| 1116 * Specialization of the type check for String and its supertype | 1150 * Specialization of the type check for String and its supertype |
| 1117 * since [value] can be a JS primitive. | 1151 * since [value] can be a JS primitive. |
| 1118 */ | 1152 */ |
| 1119 stringSuperTypeCheck(value, property) { | 1153 stringSuperTypeCheck(value, property) { |
| 1120 if (value === null) return value; | 1154 if (value === null) return value; |
| 1121 if (value is String) return value; | 1155 if (value is String) return value; |
| 1122 if (JS('bool', '!!#[#]', value, property)) return value; | 1156 if (JS('bool', '!!#[#]', value, property)) return value; |
| 1123 propertyTypeError(value, property); | 1157 propertyTypeError(value, property); |
| 1124 } | 1158 } |
| 1125 | 1159 |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1229 throw new NoSuchMethodException(obj, name, arguments); | 1263 throw new NoSuchMethodException(obj, name, arguments); |
| 1230 } | 1264 } |
| 1231 | 1265 |
| 1232 /** | 1266 /** |
| 1233 * Called by generated code when a static field's initializer references the | 1267 * Called by generated code when a static field's initializer references the |
| 1234 * field that is currently being initialized. | 1268 * field that is currently being initialized. |
| 1235 */ | 1269 */ |
| 1236 void throwCyclicInit(String staticName) { | 1270 void throwCyclicInit(String staticName) { |
| 1237 throw new RuntimeError("Cyclic initialization for static $staticName"); | 1271 throw new RuntimeError("Cyclic initialization for static $staticName"); |
| 1238 } | 1272 } |
| OLD | NEW |