| 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 _js_helper; | 5 library _js_helper; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 import 'dart:_foreign_helper' show DART_CLOSURE_TO_JS, | 8 import 'dart:_foreign_helper' show DART_CLOSURE_TO_JS, |
| 9 JS, | 9 JS, |
| 10 JS_CALL_IN_ISOLATE, | 10 JS_CALL_IN_ISOLATE, |
| (...skipping 1076 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1087 if (value is bool) return value; | 1087 if (value is bool) return value; |
| 1088 throw new TypeErrorImplementation(value, 'bool'); | 1088 throw new TypeErrorImplementation(value, 'bool'); |
| 1089 } | 1089 } |
| 1090 | 1090 |
| 1091 boolTypeCast(value) { | 1091 boolTypeCast(value) { |
| 1092 if (value is bool || value == null) return value; | 1092 if (value is bool || value == null) return value; |
| 1093 throw new CastErrorImplementation( | 1093 throw new CastErrorImplementation( |
| 1094 Primitives.objectTypeName(value), 'bool'); | 1094 Primitives.objectTypeName(value), 'bool'); |
| 1095 } | 1095 } |
| 1096 | 1096 |
| 1097 functionTypeCheck(value) { | |
| 1098 if (value == null) return value; | |
| 1099 if (value is Function) return value; | |
| 1100 throw new TypeErrorImplementation(value, 'Function'); | |
| 1101 } | |
| 1102 | |
| 1103 functionTypeCast(value) { | |
| 1104 if (value is Function || value == null) return value; | |
| 1105 throw new CastErrorImplementation( | |
| 1106 Primitives.objectTypeName(value), 'Function'); | |
| 1107 } | |
| 1108 | |
| 1109 intTypeCheck(value) { | 1097 intTypeCheck(value) { |
| 1110 if (value == null) return value; | 1098 if (value == null) return value; |
| 1111 if (value is int) return value; | 1099 if (value is int) return value; |
| 1112 throw new TypeErrorImplementation(value, 'int'); | 1100 throw new TypeErrorImplementation(value, 'int'); |
| 1113 } | 1101 } |
| 1114 | 1102 |
| 1115 intTypeCast(value) { | 1103 intTypeCast(value) { |
| 1116 if (value is int || value == null) return value; | 1104 if (value is int || value == null) return value; |
| 1117 throw new CastErrorImplementation( | 1105 throw new CastErrorImplementation( |
| 1118 Primitives.objectTypeName(value), 'int'); | 1106 Primitives.objectTypeName(value), 'int'); |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1385 expectedArgumentNames); | 1373 expectedArgumentNames); |
| 1386 } | 1374 } |
| 1387 | 1375 |
| 1388 /** | 1376 /** |
| 1389 * Called by generated code when a static field's initializer references the | 1377 * Called by generated code when a static field's initializer references the |
| 1390 * field that is currently being initialized. | 1378 * field that is currently being initialized. |
| 1391 */ | 1379 */ |
| 1392 void throwCyclicInit(String staticName) { | 1380 void throwCyclicInit(String staticName) { |
| 1393 throw new RuntimeError("Cyclic initialization for static $staticName"); | 1381 throw new RuntimeError("Cyclic initialization for static $staticName"); |
| 1394 } | 1382 } |
| OLD | NEW |