| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 // Native helpers generated by the compiler | 5 // Native helpers generated by the compiler |
| 6 // TODO(jmesserly): more natives should use this pattern | 6 // TODO(jmesserly): more natives should use this pattern |
| 7 | 7 |
| 8 // Translate a JavaScript exception to a Dart exception | 8 // Translate a JavaScript exception to a Dart exception |
| 9 // TODO(jmesserly): cross browser support. This is Chrome specific. | 9 // TODO(jmesserly): cross browser support. This is Chrome specific. |
| 10 _toDartException(e) native @""" | 10 _toDartException(e) native @""" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 return attachStack(new NullPointerException()); | 35 return attachStack(new NullPointerException()); |
| 36 } else { | 36 } else { |
| 37 return attachStack(new ObjectNotClosureException()); | 37 return attachStack(new ObjectNotClosureException()); |
| 38 } | 38 } |
| 39 break; | 39 break; |
| 40 case 'non_object_property_call': | 40 case 'non_object_property_call': |
| 41 case 'non_object_property_load': | 41 case 'non_object_property_load': |
| 42 return attachStack(new NullPointerException()); | 42 return attachStack(new NullPointerException()); |
| 43 break; | 43 break; |
| 44 case 'undefined_method': | 44 case 'undefined_method': |
| 45 if (e.arguments[0] == 'call' || e.arguments[0] == 'apply') { | 45 var mname = e.arguments[0]; |
| 46 if (typeof(mname) == 'string' && (mname.indexOf('call$') == 0 |
| 47 || mname == 'call' || mname == 'apply')) { |
| 46 return attachStack(new ObjectNotClosureException()); | 48 return attachStack(new ObjectNotClosureException()); |
| 47 } else { | 49 } else { |
| 48 // TODO(jmesserly): fix noSuchMethod on operators so we don't hit this | 50 // TODO(jmesserly): fix noSuchMethod on operators so we don't hit this |
| 49 return attachStack(new NoSuchMethodException('', e.arguments[0], [])); | 51 return attachStack(new NoSuchMethodException('', e.arguments[0], [])); |
| 50 } | 52 } |
| 51 break; | 53 break; |
| 52 } | 54 } |
| 53 } else if (e instanceof RangeError) { | 55 } else if (e instanceof RangeError) { |
| 54 if (e.message.indexOf('call stack') >= 0) { | 56 if (e.message.indexOf('call stack') >= 0) { |
| 55 return attachStack(new StackOverflowException()); | 57 return attachStack(new StackOverflowException()); |
| 56 } | 58 } |
| 57 } | 59 } |
| 58 return e;""" { | 60 return e;""" { |
| 59 // Ensure constructors are generated | 61 // Ensure constructors are generated |
| 60 new ObjectNotClosureException(); | 62 new ObjectNotClosureException(); |
| 61 new NullPointerException(); | 63 new NullPointerException(); |
| 62 new NoSuchMethodException(null, null, null); | 64 new NoSuchMethodException(null, null, null); |
| 63 new StackOverflowException(); | 65 new StackOverflowException(); |
| 64 } | 66 } |
| OLD | NEW |