Skip to content
This repository was archived by the owner on Feb 22, 2018. It is now read-only.

Commit 9baaa46

Browse files
author
John Messerly
committed
fix some errors in our SDK, mostly around numbers, see issue #103
also improved codegen of JSNumber's methods [email protected] Review URL: https://codereview.chromium.org/1348453004 .
1 parent 8b8d2e2 commit 9baaa46

21 files changed

+318
-453
lines changed

lib/runtime/_operations.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,15 @@ dart_library.library('dart_runtime/_operations', null, /* Imports */[
232232
}
233233
exports.cast = cast;
234234

235+
function asInt(obj) {
236+
if (Math.floor(obj) != obj) {
237+
// Note: null will also be caught by this check
238+
errors.throwCastError(rtti.realRuntimeType(obj), core.int);
239+
}
240+
return obj;
241+
}
242+
exports.asInt = asInt;
243+
235244
function arity(f) {
236245
// TODO(jmesserly): need to parse optional params.
237246
// In ES6, length is the number of required arguments.

0 commit comments

Comments
 (0)