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

Unified Diff: frog/lib/natives.dart

Issue 8746005: Fix a bunch of issues with 'hidden' DOM types. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: removed dead code Created 9 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: frog/lib/natives.dart
diff --git a/frog/lib/natives.dart b/frog/lib/natives.dart
index 034d59321ad2055cd99263b5d302f2fceb1e405b..79bfd44b37d0b3707c23d38aaa98156242a78b97 100644
--- a/frog/lib/natives.dart
+++ b/frog/lib/natives.dart
@@ -7,57 +7,56 @@
// Translate a JavaScript exception to a Dart exception
// TODO(jmesserly): cross browser support. This is Chrome specific.
-_toDartException(e) native @"""{
- function attachStack(dartEx) {
- // TODO(jmesserly): setting the stack property is not a long term solution.
- var stack = e.stack;
- // The stack contains the error message, and the stack is all that is
- // printed (the exception's toString() is never called). Make the Dart
- // exception's toString() be the dominant message.
- if (typeof stack == 'string') {
- var message = dartEx.toString();
- if (/^(Type|Range)Error:/.test(stack)) {
- // Indent JS message (it can be helpful) so new message stands out.
- stack = ' (' + stack.substring(0, stack.indexOf('\n')) + ')\n' +
- stack.substring(stack.indexOf('\n') + 1);
- }
- stack = message + '\n' + stack;
+_toDartException(e) native @"""
+function attachStack(dartEx) {
+ // TODO(jmesserly): setting the stack property is not a long term solution.
+ var stack = e.stack;
+ // The stack contains the error message, and the stack is all that is
+ // printed (the exception's toString() is never called). Make the Dart
+ // exception's toString() be the dominant message.
+ if (typeof stack == 'string') {
+ var message = dartEx.toString();
+ if (/^(Type|Range)Error:/.test(stack)) {
+ // Indent JS message (it can be helpful) so new message stands out.
+ stack = ' (' + stack.substring(0, stack.indexOf('\n')) + ')\n' +
+ stack.substring(stack.indexOf('\n') + 1);
}
- dartEx.stack = stack;
- return dartEx;
+ stack = message + '\n' + stack;
}
+ dartEx.stack = stack;
+ return dartEx;
+}
- if (e instanceof TypeError) {
- switch(e.type) {
- case 'property_not_function':
- case 'called_non_callable':
- if (e.arguments[0] == null) {
- return attachStack(new NullPointerException());
- } else {
- return attachStack(new ObjectNotClosureException());
- }
- break;
- case 'non_object_property_call':
- case 'non_object_property_load':
+if (e instanceof TypeError) {
+ switch(e.type) {
+ case 'property_not_function':
+ case 'called_non_callable':
+ if (e.arguments[0] == null) {
return attachStack(new NullPointerException());
- break;
- case 'undefined_method':
- if (e.arguments[0] == 'call' || e.arguments[0] == 'apply') {
- return attachStack(new ObjectNotClosureException());
- } else {
- // TODO(jmesserly): can this ever happen?
- // sra: Yes, seen on '$add'.
- return attachStack(new NoSuchMethodException('', e.arguments[0], []));
- }
- break;
- }
- } else if (e instanceof RangeError) {
- if (e.message.indexOf('call stack') >= 0) {
- return attachStack(new StackOverflowException());
- }
+ } else {
+ return attachStack(new ObjectNotClosureException());
+ }
+ break;
+ case 'non_object_property_call':
+ case 'non_object_property_load':
+ return attachStack(new NullPointerException());
+ break;
+ case 'undefined_method':
+ if (e.arguments[0] == 'call' || e.arguments[0] == 'apply') {
+ return attachStack(new ObjectNotClosureException());
+ } else {
+ // TODO(jmesserly): can this ever happen?
+ // sra: Yes, seen on '$add'.
+ return attachStack(new NoSuchMethodException('', e.arguments[0], []));
+ }
+ break;
}
- return e;
-}""" {
+} else if (e instanceof RangeError) {
+ if (e.message.indexOf('call stack') >= 0) {
+ return attachStack(new StackOverflowException());
+ }
+}
+return e;""" {
// Ensure constructors are generated
new ObjectNotClosureException();
new NullPointerException();
« frog/lib/corelib.dart ('K') | « frog/lib/corelib.dart ('k') | frog/member.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698