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

Unified Diff: dart/frog/leg/lib/js_helper.dart

Issue 9355014: Two minor bug fixes: a type error in the parser, and throwing the (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 10 months 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
« no previous file with comments | « no previous file | dart/frog/leg/scanner/partial_parser.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/frog/leg/lib/js_helper.dart
diff --git a/dart/frog/leg/lib/js_helper.dart b/dart/frog/leg/lib/js_helper.dart
index d28d6222d981c39d7800b1be3fb8974cdb99c1af..ede2331b27d894bed0bf9a6a788e4b51f5b9f6e4 100644
--- a/dart/frog/leg/lib/js_helper.dart
+++ b/dart/frog/leg/lib/js_helper.dart
@@ -4,15 +4,6 @@
#library('js_helper');
-$throw(String msg) {
- var e = JS("Object", @"new Error($0)", msg);
- var hasTrace = JS("bool", @"Error.captureStackTrace !== (void 0)");
- if (hasTrace) {
- JS("void", @"Error.captureStackTrace($0)", e);
- }
- throw e;
-}
-
/**
* Returns true if both arguments are numbers.
* If only the first argument is a number, throws the given message as
@@ -208,8 +199,12 @@ neg(var a) {
index(var a, var index) {
if (a is String || isJSArray(a)) {
- if (!(index is int)) $throw('Illegal argument');
- if (index < 0 || index >= a.length) $throw('Out of bounds');
+ if (!(index is int)) {
+ throw new IllegalArgumentException(index);
+ }
+ if (index < 0 || index >= a.length) {
+ throw new IndexOutOfRangeException(index);
+ }
return JS("Object", @"$0[$1]", a, index);
}
return UNINTERCEPTED(a[index]);
@@ -217,8 +212,12 @@ index(var a, var index) {
indexSet(var a, var index, var value) {
if (isJSArray(a)) {
- if (!(index is int)) $throw('Illegal argument');
- if (index < 0 || index >= a.length) $throw('Out of bounds');
+ if (!(index is int)) {
+ throw new IllegalArgumentException(index);
+ }
+ if (index < 0 || index >= a.length) {
+ throw new IndexOutOfRangeException(index);
+ }
return JS("Object", @"$0[$1] = $2", a, index, value);
}
return UNINTERCEPTED(a[index] = value);
« no previous file with comments | « no previous file | dart/frog/leg/scanner/partial_parser.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698