| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library _js_helper; | 5 library _js_helper; |
| 6 | 6 |
| 7 import 'dart:_async_await_error_codes' as async_error_codes; | 7 import 'dart:_async_await_error_codes' as async_error_codes; |
| 8 | 8 |
| 9 import 'dart:_js_embedded_names' show | 9 import 'dart:_js_embedded_names' show |
| 10 DEFERRED_LIBRARY_URIS, | 10 DEFERRED_LIBRARY_URIS, |
| (...skipping 1006 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1017 // may return -0.0 instead of 0. | 1017 // may return -0.0 instead of 0. |
| 1018 | 1018 |
| 1019 static getYear(receiver) { | 1019 static getYear(receiver) { |
| 1020 return (receiver.isUtc) | 1020 return (receiver.isUtc) |
| 1021 ? JS('int', r'(#.getUTCFullYear() + 0)', lazyAsJsDate(receiver)) | 1021 ? JS('int', r'(#.getUTCFullYear() + 0)', lazyAsJsDate(receiver)) |
| 1022 : JS('int', r'(#.getFullYear() + 0)', lazyAsJsDate(receiver)); | 1022 : JS('int', r'(#.getFullYear() + 0)', lazyAsJsDate(receiver)); |
| 1023 } | 1023 } |
| 1024 | 1024 |
| 1025 static getMonth(receiver) { | 1025 static getMonth(receiver) { |
| 1026 return (receiver.isUtc) | 1026 return (receiver.isUtc) |
| 1027 ? JS('int', r'#.getUTCMonth() + 1', lazyAsJsDate(receiver)) | 1027 ? JS('JSUInt31', r'#.getUTCMonth() + 1', lazyAsJsDate(receiver)) |
| 1028 : JS('int', r'#.getMonth() + 1', lazyAsJsDate(receiver)); | 1028 : JS('JSUInt31', r'#.getMonth() + 1', lazyAsJsDate(receiver)); |
| 1029 } | 1029 } |
| 1030 | 1030 |
| 1031 static getDay(receiver) { | 1031 static getDay(receiver) { |
| 1032 return (receiver.isUtc) | 1032 return (receiver.isUtc) |
| 1033 ? JS('int', r'(#.getUTCDate() + 0)', lazyAsJsDate(receiver)) | 1033 ? JS('JSUInt31', r'(#.getUTCDate() + 0)', lazyAsJsDate(receiver)) |
| 1034 : JS('int', r'(#.getDate() + 0)', lazyAsJsDate(receiver)); | 1034 : JS('JSUInt31', r'(#.getDate() + 0)', lazyAsJsDate(receiver)); |
| 1035 } | 1035 } |
| 1036 | 1036 |
| 1037 static getHours(receiver) { | 1037 static getHours(receiver) { |
| 1038 return (receiver.isUtc) | 1038 return (receiver.isUtc) |
| 1039 ? JS('int', r'(#.getUTCHours() + 0)', lazyAsJsDate(receiver)) | 1039 ? JS('JSUInt31', r'(#.getUTCHours() + 0)', lazyAsJsDate(receiver)) |
| 1040 : JS('int', r'(#.getHours() + 0)', lazyAsJsDate(receiver)); | 1040 : JS('JSUInt31', r'(#.getHours() + 0)', lazyAsJsDate(receiver)); |
| 1041 } | 1041 } |
| 1042 | 1042 |
| 1043 static getMinutes(receiver) { | 1043 static getMinutes(receiver) { |
| 1044 return (receiver.isUtc) | 1044 return (receiver.isUtc) |
| 1045 ? JS('int', r'(#.getUTCMinutes() + 0)', lazyAsJsDate(receiver)) | 1045 ? JS('JSUInt31', r'(#.getUTCMinutes() + 0)', lazyAsJsDate(receiver)) |
| 1046 : JS('int', r'(#.getMinutes() + 0)', lazyAsJsDate(receiver)); | 1046 : JS('JSUInt31', r'(#.getMinutes() + 0)', lazyAsJsDate(receiver)); |
| 1047 } | 1047 } |
| 1048 | 1048 |
| 1049 static getSeconds(receiver) { | 1049 static getSeconds(receiver) { |
| 1050 return (receiver.isUtc) | 1050 return (receiver.isUtc) |
| 1051 ? JS('int', r'(#.getUTCSeconds() + 0)', lazyAsJsDate(receiver)) | 1051 ? JS('JSUInt31', r'(#.getUTCSeconds() + 0)', lazyAsJsDate(receiver)) |
| 1052 : JS('int', r'(#.getSeconds() + 0)', lazyAsJsDate(receiver)); | 1052 : JS('JSUInt31', r'(#.getSeconds() + 0)', lazyAsJsDate(receiver)); |
| 1053 } | 1053 } |
| 1054 | 1054 |
| 1055 static getMilliseconds(receiver) { | 1055 static getMilliseconds(receiver) { |
| 1056 return (receiver.isUtc) | 1056 return (receiver.isUtc) |
| 1057 ? JS('int', r'(#.getUTCMilliseconds() + 0)', lazyAsJsDate(receiver)) | 1057 ? JS('JSUInt31', r'(#.getUTCMilliseconds() + 0)', lazyAsJsDate(receiver)) |
| 1058 : JS('int', r'(#.getMilliseconds() + 0)', lazyAsJsDate(receiver)); | 1058 : JS('JSUInt31', r'(#.getMilliseconds() + 0)', lazyAsJsDate(receiver)); |
| 1059 } | 1059 } |
| 1060 | 1060 |
| 1061 static getWeekday(receiver) { | 1061 static getWeekday(receiver) { |
| 1062 int weekday = (receiver.isUtc) | 1062 int weekday = (receiver.isUtc) |
| 1063 ? JS('int', r'#.getUTCDay() + 0', lazyAsJsDate(receiver)) | 1063 ? JS('int', r'#.getUTCDay() + 0', lazyAsJsDate(receiver)) |
| 1064 : JS('int', r'#.getDay() + 0', lazyAsJsDate(receiver)); | 1064 : JS('int', r'#.getDay() + 0', lazyAsJsDate(receiver)); |
| 1065 // Adjust by one because JS weeks start on Sunday. | 1065 // Adjust by one because JS weeks start on Sunday. |
| 1066 return (weekday + 6) % 7 + 1; | 1066 return (weekday + 6) % 7 + 1; |
| 1067 } | 1067 } |
| 1068 | 1068 |
| (...skipping 3005 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4074 // This is a function that will return a helper function that does the | 4074 // This is a function that will return a helper function that does the |
| 4075 // iteration of the sync*. | 4075 // iteration of the sync*. |
| 4076 // | 4076 // |
| 4077 // Each invocation should give a body with fresh state. | 4077 // Each invocation should give a body with fresh state. |
| 4078 final dynamic /* js function */ _outerHelper; | 4078 final dynamic /* js function */ _outerHelper; |
| 4079 | 4079 |
| 4080 SyncStarIterable(this._outerHelper); | 4080 SyncStarIterable(this._outerHelper); |
| 4081 | 4081 |
| 4082 Iterator get iterator => new SyncStarIterator(JS('', '#()', _outerHelper)); | 4082 Iterator get iterator => new SyncStarIterator(JS('', '#()', _outerHelper)); |
| 4083 } | 4083 } |
| OLD | NEW |