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

Unified Diff: lib/runtime/_operations.js

Issue 1348453004: fix some errors in our SDK, mostly around numbers (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 3 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 | lib/runtime/dart/_interceptors.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/runtime/_operations.js
diff --git a/lib/runtime/_operations.js b/lib/runtime/_operations.js
index 696f540f654d9dabafab75939784500cbbbdc1c7..b5a1743b1510ccfefecaadfa2e1ae04e133fe539 100644
--- a/lib/runtime/_operations.js
+++ b/lib/runtime/_operations.js
@@ -232,6 +232,15 @@ dart_library.library('dart_runtime/_operations', null, /* Imports */[
}
exports.cast = cast;
+ function asInt(obj) {
+ if (Math.floor(obj) != obj) {
+ // Note: null will also be caught by this check
+ errors.throwCastError(rtti.realRuntimeType(obj), core.int);
+ }
+ return obj;
+ }
+ exports.asInt = asInt;
+
function arity(f) {
// TODO(jmesserly): need to parse optional params.
// In ES6, length is the number of required arguments.
« no previous file with comments | « no previous file | lib/runtime/dart/_interceptors.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698