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

Unified Diff: sdk/lib/_internal/js_runtime/lib/js_helper.dart

Issue 2008163002: Add types on internal DateTime accessors (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Two more DateTime types Created 4 years, 7 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/js_runtime/lib/js_helper.dart
diff --git a/sdk/lib/_internal/js_runtime/lib/js_helper.dart b/sdk/lib/_internal/js_runtime/lib/js_helper.dart
index 5e4d69aca847eec66f76ea172b3f41abbeceb0ad..6cfcda8d7cb9a8c1d3d255b436f073557cae38ee 100644
--- a/sdk/lib/_internal/js_runtime/lib/js_helper.dart
+++ b/sdk/lib/_internal/js_runtime/lib/js_helper.dart
@@ -1039,7 +1039,7 @@ class Primitives {
return JS('String', "#.charCodeAt(0) == 0 ? # : #", str, str, str);
}
- static String getTimeZoneName(receiver) {
+ static String getTimeZoneName(DateTime receiver) {
// Firefox and Chrome emit the timezone in parenthesis.
// Example: "Wed May 16 2012 21:13:00 GMT+0200 (CEST)".
// We extract this name using a regexp.
@@ -1073,7 +1073,7 @@ class Primitives {
return "";
}
- static int getTimeZoneOffsetInMinutes(receiver) {
+ static int getTimeZoneOffsetInMinutes(DateTime receiver) {
// Note that JS and Dart disagree on the sign of the offset.
return -JS('int', r'#.getTimezoneOffset()', lazyAsJsDate(receiver));
}
@@ -1118,7 +1118,7 @@ class Primitives {
}
// Lazily keep a JS Date stored in the JS object.
- static lazyAsJsDate(receiver) {
+ static lazyAsJsDate(DateTime receiver) {
if (JS('bool', r'#.date === (void 0)', receiver)) {
JS('void', r'#.date = new Date(#)', receiver,
receiver.millisecondsSinceEpoch);
@@ -1130,49 +1130,49 @@ class Primitives {
// that the result is really an integer, because the JavaScript implementation
// may return -0.0 instead of 0.
- static getYear(receiver) {
+ static getYear(DateTime receiver) {
return (receiver.isUtc)
? JS('int', r'(#.getUTCFullYear() + 0)', lazyAsJsDate(receiver))
: JS('int', r'(#.getFullYear() + 0)', lazyAsJsDate(receiver));
}
- static getMonth(receiver) {
+ static getMonth(DateTime receiver) {
return (receiver.isUtc)
? JS('JSUInt31', r'#.getUTCMonth() + 1', lazyAsJsDate(receiver))
: JS('JSUInt31', r'#.getMonth() + 1', lazyAsJsDate(receiver));
}
- static getDay(receiver) {
+ static getDay(DateTime receiver) {
return (receiver.isUtc)
? JS('JSUInt31', r'(#.getUTCDate() + 0)', lazyAsJsDate(receiver))
: JS('JSUInt31', r'(#.getDate() + 0)', lazyAsJsDate(receiver));
}
- static getHours(receiver) {
+ static getHours(DateTime receiver) {
return (receiver.isUtc)
? JS('JSUInt31', r'(#.getUTCHours() + 0)', lazyAsJsDate(receiver))
: JS('JSUInt31', r'(#.getHours() + 0)', lazyAsJsDate(receiver));
}
- static getMinutes(receiver) {
+ static getMinutes(DateTime receiver) {
return (receiver.isUtc)
? JS('JSUInt31', r'(#.getUTCMinutes() + 0)', lazyAsJsDate(receiver))
: JS('JSUInt31', r'(#.getMinutes() + 0)', lazyAsJsDate(receiver));
}
- static getSeconds(receiver) {
+ static getSeconds(DateTime receiver) {
return (receiver.isUtc)
? JS('JSUInt31', r'(#.getUTCSeconds() + 0)', lazyAsJsDate(receiver))
: JS('JSUInt31', r'(#.getSeconds() + 0)', lazyAsJsDate(receiver));
}
- static getMilliseconds(receiver) {
+ static getMilliseconds(DateTime receiver) {
return (receiver.isUtc)
? JS('JSUInt31', r'(#.getUTCMilliseconds() + 0)', lazyAsJsDate(receiver))
: JS('JSUInt31', r'(#.getMilliseconds() + 0)', lazyAsJsDate(receiver));
}
- static getWeekday(receiver) {
+ static getWeekday(DateTime receiver) {
int weekday = (receiver.isUtc)
? JS('int', r'#.getUTCDay() + 0', lazyAsJsDate(receiver))
: JS('int', r'#.getDay() + 0', lazyAsJsDate(receiver));
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698