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

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

Issue 2738963002: DateTime and Duration tweaks for better dart2js codegen (Closed)
Patch Set: Created 3 years, 9 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 | sdk/lib/core/duration.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/js_runtime/lib/core_patch.dart
diff --git a/sdk/lib/_internal/js_runtime/lib/core_patch.dart b/sdk/lib/_internal/js_runtime/lib/core_patch.dart
index e5e76bfa6478fc459621dd449463ed15e6fbaab9..45466e3055f79eed78d2b723c51b5bc045688002 100644
--- a/sdk/lib/_internal/js_runtime/lib/core_patch.dart
+++ b/sdk/lib/_internal/js_runtime/lib/core_patch.dart
@@ -234,7 +234,8 @@ class DateTime {
@patch
DateTime.fromMillisecondsSinceEpoch(int millisecondsSinceEpoch,
{bool isUtc: false})
- : this._withValue(millisecondsSinceEpoch, isUtc: isUtc);
+ // `0 + millisecondsSinceEpoch` forces the inferred result to be non-null.
+ : this._withValue(0 + millisecondsSinceEpoch, isUtc: isUtc);
@patch
DateTime.fromMicrosecondsSinceEpoch(int microsecondsSinceEpoch,
@@ -318,7 +319,7 @@ class DateTime {
int get millisecondsSinceEpoch => _value;
@patch
- int get microsecondsSinceEpoch => _value * 1000;
+ int get microsecondsSinceEpoch => 1000 * _value;
@patch
int get year => Primitives.getYear(this);
« no previous file with comments | « no previous file | sdk/lib/core/duration.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698