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 | 8 |
9 part 'constant_map.dart'; | 9 part 'constant_map.dart'; |
10 part 'native_helper.dart'; | 10 part 'native_helper.dart'; |
(...skipping 998 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1009 } | 1009 } |
1010 | 1010 |
1011 var ieErrorCode = JS('int', '#.number & 0xffff', ex); | 1011 var ieErrorCode = JS('int', '#.number & 0xffff', ex); |
1012 var ieFacilityNumber = JS('int', '#.number>>16 & 0x1FFF', ex); | 1012 var ieFacilityNumber = JS('int', '#.number>>16 & 0x1FFF', ex); |
1013 // If we cannot use [type] to determine what kind of exception | 1013 // If we cannot use [type] to determine what kind of exception |
1014 // we're dealing with we fall back on looking at the exception | 1014 // we're dealing with we fall back on looking at the exception |
1015 // message if it is available and a string. | 1015 // message if it is available and a string. |
1016 if (message is String) { | 1016 if (message is String) { |
1017 if (message.endsWith('is null') || | 1017 if (message.endsWith('is null') || |
1018 message.endsWith('is undefined') || | 1018 message.endsWith('is undefined') || |
1019 message.endsWith('is null or undefined')) { | 1019 message.endsWith('is null or undefined') || |
| 1020 message.endsWith('of null')) { |
1020 return new NoSuchMethodError(null, '<unknown>', [], {}); | 1021 return new NoSuchMethodError(null, '<unknown>', [], {}); |
1021 } else if (contains(message, ' has no method ') || | 1022 } else if (contains(message, ' has no method ') || |
1022 contains(message, ' is not a function') || | 1023 contains(message, ' is not a function') || |
1023 (ieErrorCode == 438 && ieFacilityNumber == 10)) { | 1024 (ieErrorCode == 438 && ieFacilityNumber == 10)) { |
1024 // Examples: | 1025 // Examples: |
1025 // x.foo is not a function | 1026 // x.foo is not a function |
1026 // 'undefined' is not a function (evaluating 'x.foo(1,2,3)') | 1027 // 'undefined' is not a function (evaluating 'x.foo(1,2,3)') |
1027 // Object doesn't support property or method 'foo' which sets the error | 1028 // Object doesn't support property or method 'foo' which sets the error |
1028 // code 438 in IE. | 1029 // code 438 in IE. |
1029 // TODO(kasperl): Compute the right name if possible. | 1030 // TODO(kasperl): Compute the right name if possible. |
(...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1707 if (len != t.length) return false; | 1708 if (len != t.length) return false; |
1708 for (int i = 1; i < len; i++) { | 1709 for (int i = 1; i < len; i++) { |
1709 if (!isSubtype(s[i], t[i])) { | 1710 if (!isSubtype(s[i], t[i])) { |
1710 return false; | 1711 return false; |
1711 } | 1712 } |
1712 } | 1713 } |
1713 return true; | 1714 return true; |
1714 } | 1715 } |
1715 | 1716 |
1716 createRuntimeType(String name) => new TypeImpl(name); | 1717 createRuntimeType(String name) => new TypeImpl(name); |
OLD | NEW |