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

Side by Side Diff: compiler/lib/implementation/date_implementation.dart

Issue 8786002: Check that interface constructors and default class constructors are compatible. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Check that types of constructors parameters are identical Created 9 years 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 | Annotate | Revision Log
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 // Dart core library. 5 // Dart core library.
6 6
7 // JavaScript implementation of DateImplementation. 7 // JavaScript implementation of DateImplementation.
8 class DateImplementation implements Date { 8 class DateImplementation implements Date {
9 factory DateImplementation(int years, 9 factory DateImplementation(int years,
10 int month, 10 int month,
11 int day, 11 int day,
12 int hours, 12 int hours,
13 int minutes, 13 int minutes,
14 int seconds, 14 int seconds,
15 int milliseconds) { 15 int milliseconds) {
16 return new DateImplementation.withTimeZone( 16 return new DateImplementation.withTimeZone(
17 years, month, day, 17 years, month, day,
18 hours, minutes, seconds, milliseconds, 18 hours, minutes, seconds, milliseconds,
19 new TimeZoneImplementation.local()); 19 new TimeZoneImplementation.local());
20 } 20 }
21 21
22 DateImplementation.withTimeZone(int years, 22 DateImplementation.withTimeZone(int years,
23 int month, 23 int month,
24 int day, 24 int day,
25 int hours, 25 int hours,
26 int minutes, 26 int minutes,
27 int seconds, 27 int seconds,
28 int milliseconds, 28 int milliseconds,
29 TimeZoneImplementation timeZone) 29 TimeZone timeZone)
30 : this.timeZone = timeZone, 30 : this.timeZone = timeZone,
31 value = _valueFromDecomposed(years, month, day, 31 value = _valueFromDecomposed(years, month, day,
32 hours, minutes, seconds, milliseconds, 32 hours, minutes, seconds, milliseconds,
33 timeZone.isUtc) { 33 timeZone.isUtc) {
34 } 34 }
35 35
36 DateImplementation.now() 36 DateImplementation.now()
37 : timeZone = new TimeZone.local(), 37 : timeZone = new TimeZone.local(),
38 value = _now() { 38 value = _now() {
39 } 39 }
40 40
41 DateImplementation.fromString(String formattedString) 41 DateImplementation.fromString(String formattedString)
42 : timeZone = new TimeZone.local(), 42 : timeZone = new TimeZone.local(),
43 value = _valueFromString(formattedString) { 43 value = _valueFromString(formattedString) {
44 } 44 }
45 45
46 const DateImplementation.fromEpoch(this.value, this.timeZone); 46 const DateImplementation.fromEpoch(int this.value, TimeZone this.timeZone);
47 47
48 bool operator ==(other) { 48 bool operator ==(other) {
49 if (!(other is DateImplementation)) return false; 49 if (!(other is DateImplementation)) return false;
50 return (value == other.value) && (timeZone == other.timeZone); 50 return (value == other.value) && (timeZone == other.timeZone);
51 } 51 }
52 52
53 int compareTo(Date other) { 53 int compareTo(Date other) {
54 return value.compareTo(other.value); 54 return value.compareTo(other.value);
55 } 55 }
56 56
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 static int _valueFromString(String str) native; 161 static int _valueFromString(String str) native;
162 static int _now() native; 162 static int _now() native;
163 int _getYear(int value, bool isUtc) native; 163 int _getYear(int value, bool isUtc) native;
164 int _getMonth(int value, bool isUtc) native; 164 int _getMonth(int value, bool isUtc) native;
165 int _getDay(int value, bool isUtc) native; 165 int _getDay(int value, bool isUtc) native;
166 int _getHours(int value, bool isUtc) native; 166 int _getHours(int value, bool isUtc) native;
167 int _getMinutes(int value, bool isUtc) native; 167 int _getMinutes(int value, bool isUtc) native;
168 int _getSeconds(int value, bool isUtc) native; 168 int _getSeconds(int value, bool isUtc) native;
169 int _getMilliseconds(int value, bool isUtc) native; 169 int _getMilliseconds(int value, bool isUtc) native;
170 } 170 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698