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

Unified Diff: lib/runtime/dart/js.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 | « lib/runtime/dart/core.js ('k') | lib/runtime/dart/math.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/runtime/dart/js.js
diff --git a/lib/runtime/dart/js.js b/lib/runtime/dart/js.js
index c9124c970b8c0f022df85fef0191275be70c336c..550f4725f267487e4e6e53b59c214bda2e807301 100644
--- a/lib/runtime/dart/js.js
+++ b/lib/runtime/dart/js.js
@@ -28,7 +28,7 @@ dart_library.library('dart/js', null, /* Imports */[
return dart.as(_wrapToDart(new ctor(...arguments$)), JsObject);
}
static fromBrowserObject(object) {
- if (dart.is(object, core.num) || typeof object == 'string' || typeof object == 'boolean' || object == null) {
+ if (typeof object == 'number' || typeof object == 'string' || typeof object == 'boolean' || object == null) {
dart.throw(new core.ArgumentError("object cannot be a num, string, bool, or null"));
}
return dart.as(_wrapToDart(_convertToJS(object)), JsObject);
@@ -65,13 +65,13 @@ dart_library.library('dart/js', null, /* Imports */[
return _convert(data);
}
get(property) {
- if (!(typeof property == 'string') && !dart.is(property, core.num)) {
+ if (!(typeof property == 'string') && !(typeof property == 'number')) {
dart.throw(new core.ArgumentError("property is not a String or num"));
}
return _convertToDart(this[_jsObject][property]);
}
set(property, value) {
- if (!(typeof property == 'string') && !dart.is(property, core.num)) {
+ if (!(typeof property == 'string') && !(typeof property == 'number')) {
dart.throw(new core.ArgumentError("property is not a String or num"));
}
this[_jsObject][property] = _convertToJS(value);
@@ -84,13 +84,13 @@ dart_library.library('dart/js', null, /* Imports */[
return dart.is(other, JsObject) && this[_jsObject] === dart.dload(other, _jsObject);
}
hasProperty(property) {
- if (!(typeof property == 'string') && !dart.is(property, core.num)) {
+ if (!(typeof property == 'string') && !(typeof property == 'number')) {
dart.throw(new core.ArgumentError("property is not a String or num"));
}
return property in this[_jsObject];
}
deleteProperty(property) {
- if (!(typeof property == 'string') && !dart.is(property, core.num)) {
+ if (!(typeof property == 'string') && !(typeof property == 'number')) {
dart.throw(new core.ArgumentError("property is not a String or num"));
}
delete this[_jsObject][property];
@@ -109,7 +109,7 @@ dart_library.library('dart/js', null, /* Imports */[
callMethod(method, args) {
if (args === void 0)
args = null;
- if (!(typeof method == 'string') && !dart.is(method, core.num)) {
+ if (!(typeof method == 'string') && !(typeof method == 'number')) {
dart.throw(new core.ArgumentError("method is not a String or num"));
}
if (args != null)
@@ -202,14 +202,14 @@ dart_library.library('dart/js', null, /* Imports */[
}
}
get(index) {
- if (dart.is(index, core.num) && index == index[dartx.toInt]()) {
+ if (typeof index == 'number' && index == index[dartx.toInt]()) {
this[_checkIndex](index);
}
return dart.as(super.get(index), E);
}
set(index, value) {
dart.as(value, E);
- if (dart.is(index, core.num) && index == index[dartx.toInt]()) {
+ if (typeof index == 'number' && index == index[dartx.toInt]()) {
this[_checkIndex](index);
}
super.set(index, value);
@@ -328,7 +328,7 @@ dart_library.library('dart/js', null, /* Imports */[
constructors: () => ({_DartObject: [_DartObject, [dart.dynamic]]})
});
function _convertToJS(o) {
- if (o == null || typeof o == 'string' || dart.is(o, core.num) || typeof o == 'boolean' || dart.notNull(_isBrowserType(o))) {
+ if (o == null || typeof o == 'string' || typeof o == 'number' || typeof o == 'boolean' || dart.notNull(_isBrowserType(o))) {
return o;
} else if (dart.is(o, core.DateTime)) {
return _js_helper.Primitives.lazyAsJsDate(o);
@@ -355,7 +355,7 @@ dart_library.library('dart/js', null, /* Imports */[
return o;
} else if (o instanceof Date) {
let ms = o.getTime();
- return new core.DateTime.fromMillisecondsSinceEpoch(ms);
+ return new core.DateTime.fromMillisecondsSinceEpoch(dart.asInt(ms));
} else if (dart.is(o, _DartObject) && dart.jsobject != dart.realRuntimeType(o)) {
return dart.dload(o, _dartObj);
} else {
« no previous file with comments | « lib/runtime/dart/core.js ('k') | lib/runtime/dart/math.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698