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

Side by Side Diff: test/generated_sdk/lib/core/date_time.dart

Issue 959913003: cleanup patch generation to preseve comments and remove @patch (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 10 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 unified diff | Download patch
« no previous file with comments | « test/generated_sdk/lib/core/bool.dart ('k') | test/generated_sdk/lib/core/double.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 part of dart.core; 5 part of dart.core;
6 6
7 /** 7 /**
8 * An instant in time, such as July 20, 1969, 8:18pm GMT. 8 * An instant in time, such as July 20, 1969, 8:18pm GMT.
9 * 9 *
10 * Create a DateTime object by using one of the constructors 10 * Create a DateTime object by using one of the constructors
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 * Duration difference = berlinWallFell.difference(dDay); 568 * Duration difference = berlinWallFell.difference(dDay);
569 * assert(difference.inDays == 16592); 569 * assert(difference.inDays == 16592);
570 */ 570 */
571 571
572 Duration difference(DateTime other) { 572 Duration difference(DateTime other) {
573 int ms = millisecondsSinceEpoch; 573 int ms = millisecondsSinceEpoch;
574 int otherMs = other.millisecondsSinceEpoch; 574 int otherMs = other.millisecondsSinceEpoch;
575 return new Duration(milliseconds: ms - otherMs); 575 return new Duration(milliseconds: ms - otherMs);
576 } 576 }
577 577
578 @patch
579 DateTime._internal(int year, 578 DateTime._internal(int year,
580 int month, 579 int month,
581 int day, 580 int day,
582 int hour, 581 int hour,
583 int minute, 582 int minute,
584 int second, 583 int second,
585 int millisecond, 584 int millisecond,
586 bool isUtc) 585 bool isUtc)
587 // checkBool is manually inlined here because dart2js doesn't inline it 586 // checkBool is manually inlined here because dart2js doesn't inline it
588 // and [isUtc] is usually a constant. 587 // and [isUtc] is usually a constant.
589 : this.isUtc = isUtc is bool ? isUtc : throw new ArgumentError(isUtc), 588 : this.isUtc = isUtc is bool ? isUtc : throw new ArgumentError(isUtc),
590 millisecondsSinceEpoch = checkInt(Primitives.valueFromDecomposedDate( 589 millisecondsSinceEpoch = checkInt(Primitives.valueFromDecomposedDate(
591 year, month, day, hour, minute, second, millisecond, isUtc)); 590 year, month, day, hour, minute, second, millisecond, isUtc));
592 @patch
593 DateTime._now() 591 DateTime._now()
594 : isUtc = false, 592 : isUtc = false,
595 millisecondsSinceEpoch = Primitives.dateNow(); 593 millisecondsSinceEpoch = Primitives.dateNow();
596 @patch 594 /// Returns the time as milliseconds since epoch, or null if the
595 /// values are out of range.
597 static int _brokenDownDateToMillisecondsSinceEpoch( 596 static int _brokenDownDateToMillisecondsSinceEpoch(
598 int year, int month, int day, int hour, int minute, int second, 597 int year, int month, int day, int hour, int minute, int second,
599 int millisecond, bool isUtc) { 598 int millisecond, bool isUtc) {
600 return Primitives.valueFromDecomposedDate( 599 return Primitives.valueFromDecomposedDate(
601 year, month, day, hour, minute, second, millisecond, isUtc); 600 year, month, day, hour, minute, second, millisecond, isUtc);
602 } 601 }
603 602
604 @patch 603 /**
604 * The abbreviated time zone name—for example,
605 * [:"CET":] or [:"CEST":].
606 */
605 String get timeZoneName { 607 String get timeZoneName {
606 if (isUtc) return "UTC"; 608 if (isUtc) return "UTC";
607 return Primitives.getTimeZoneName(this); 609 return Primitives.getTimeZoneName(this);
608 } 610 }
609 611
610 @patch 612 /**
613 * The time zone offset, which
614 * is the difference between local time and UTC.
615 *
616 * The offset is positive for time zones east of UTC.
617 *
618 * Note, that JavaScript, Python and C return the difference between UTC and
619 * local time. Java, C# and Ruby return the difference between local time and
620 * UTC.
621 */
611 Duration get timeZoneOffset { 622 Duration get timeZoneOffset {
612 if (isUtc) return new Duration(); 623 if (isUtc) return new Duration();
613 return new Duration(minutes: Primitives.getTimeZoneOffsetInMinutes(this)); 624 return new Duration(minutes: Primitives.getTimeZoneOffsetInMinutes(this));
614 } 625 }
615 626
616 @patch 627 /**
628 * The year.
629 *
630 * DateTime moonLanding = DateTime.parse("1969-07-20 20:18:00");
631 * assert(moonLanding.year == 1969);
632 */
617 int get year => Primitives.getYear(this); 633 int get year => Primitives.getYear(this);
618 634
619 @patch 635 /**
636 * The month [1..12].
637 *
638 * DateTime moonLanding = DateTime.parse("1969-07-20 20:18:00");
639 * assert(moonLanding.month == 7);
640 * assert(moonLanding.month == DateTime.JULY);
641 */
620 int get month => Primitives.getMonth(this); 642 int get month => Primitives.getMonth(this);
621 643
622 @patch 644 /**
645 * The day of the month [1..31].
646 *
647 * DateTime moonLanding = DateTime.parse("1969-07-20 20:18:00");
648 * assert(moonLanding.day == 20);
649 */
623 int get day => Primitives.getDay(this); 650 int get day => Primitives.getDay(this);
624 651
625 @patch 652 /**
653 * The hour of the day, expressed as in a 24-hour clock [0..23].
654 *
655 * DateTime moonLanding = DateTime.parse("1969-07-20 20:18:00");
656 * assert(moonLanding.hour == 20);
657 */
626 int get hour => Primitives.getHours(this); 658 int get hour => Primitives.getHours(this);
627 659
628 @patch 660 /**
661 * The minute [0...59].
662 *
663 * DateTime moonLanding = DateTime.parse("1969-07-20 20:18:00");
664 * assert(moonLanding.minute == 18);
665 */
629 int get minute => Primitives.getMinutes(this); 666 int get minute => Primitives.getMinutes(this);
630 667
631 @patch 668 /**
669 * The second [0...59].
670 *
671 * DateTime moonLanding = DateTime.parse("1969-07-20 20:18:00");
672 * assert(moonLanding.second == 0);
673 */
632 int get second => Primitives.getSeconds(this); 674 int get second => Primitives.getSeconds(this);
633 675
634 @patch 676 /**
677 * The millisecond [0...999].
678 *
679 * DateTime moonLanding = DateTime.parse("1969-07-20 20:18:00");
680 * assert(moonLanding.millisecond == 0);
681 */
635 int get millisecond => Primitives.getMilliseconds(this); 682 int get millisecond => Primitives.getMilliseconds(this);
636 683
637 @patch 684 /**
685 * The day of the week [MONDAY]..[SUNDAY].
686 *
687 * In accordance with ISO 8601
688 * a week starts with Monday, which has the value 1.
689 *
690 * DateTime moonLanding = DateTime.parse("1969-07-20 20:18:00");
691 * assert(moonLanding.weekday == 7);
692 * assert(moonLanding.weekday == DateTime.SUNDAY);
693 *
694 */
638 int get weekday => Primitives.getWeekday(this); 695 int get weekday => Primitives.getWeekday(this);
639 } 696 }
OLDNEW
« no previous file with comments | « test/generated_sdk/lib/core/bool.dart ('k') | test/generated_sdk/lib/core/double.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698