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

Side by Side Diff: lib/runtime/dart/core.js

Issue 1042003002: fix list literal initialization call fix typeof calls for primitive JS types add dart/collection.js… (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 8 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
OLDNEW
1 var core; 1 var core;
2 (function(exports) { 2 (function(exports) {
3 'use strict'; 3 'use strict';
4 class Object { 4 class Object {
5 constructor() { 5 constructor() {
6 var name = this.constructor.name; 6 var name = this.constructor.name;
7 var init = this[name]; 7 var init = this[name];
8 var result = void 0; 8 var result = void 0;
9 if (init) 9 if (init)
10 result = init.apply(this, arguments); 10 result = init.apply(this, arguments);
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 subtract(duration) { 260 subtract(duration) {
261 let ms = this.millisecondsSinceEpoch; 261 let ms = this.millisecondsSinceEpoch;
262 return new DateTime.fromMillisecondsSinceEpoch(dart.notNull(ms) - dart.not Null(duration.inMilliseconds), {isUtc: this.isUtc}); 262 return new DateTime.fromMillisecondsSinceEpoch(dart.notNull(ms) - dart.not Null(duration.inMilliseconds), {isUtc: this.isUtc});
263 } 263 }
264 difference(other) { 264 difference(other) {
265 let ms = this.millisecondsSinceEpoch; 265 let ms = this.millisecondsSinceEpoch;
266 let otherMs = other.millisecondsSinceEpoch; 266 let otherMs = other.millisecondsSinceEpoch;
267 return new Duration({milliseconds: dart.notNull(ms) - dart.notNull(otherMs )}); 267 return new Duration({milliseconds: dart.notNull(ms) - dart.notNull(otherMs )});
268 } 268 }
269 DateTime$_internal(year, month, day, hour, minute, second, millisecond, isUt c) { 269 DateTime$_internal(year, month, day, hour, minute, second, millisecond, isUt c) {
270 this.isUtc = typeof isUtc == boolean ? isUtc : dart.throw_(new ArgumentErr or(isUtc)); 270 this.isUtc = typeof isUtc == 'boolean' ? isUtc : dart.throw_(new ArgumentE rror(isUtc));
271 this.millisecondsSinceEpoch = dart.as(_js_helper.checkInt(_js_helper.Primi tives.valueFromDecomposedDate(year, month, day, hour, minute, second, millisecon d, isUtc)), int); 271 this.millisecondsSinceEpoch = dart.as(_js_helper.checkInt(_js_helper.Primi tives.valueFromDecomposedDate(year, month, day, hour, minute, second, millisecon d, isUtc)), int);
272 } 272 }
273 DateTime$_now() { 273 DateTime$_now() {
274 this.isUtc = false; 274 this.isUtc = false;
275 this.millisecondsSinceEpoch = _js_helper.Primitives.dateNow(); 275 this.millisecondsSinceEpoch = _js_helper.Primitives.dateNow();
276 } 276 }
277 static [_brokenDownDateToMillisecondsSinceEpoch$](year, month, day, hour, mi nute, second, millisecond, isUtc) { 277 static [_brokenDownDateToMillisecondsSinceEpoch$](year, month, day, hour, mi nute, second, millisecond, isUtc) {
278 return dart.as(_js_helper.Primitives.valueFromDecomposedDate(year, month, day, hour, minute, second, millisecond, isUtc), int); 278 return dart.as(_js_helper.Primitives.valueFromDecomposedDate(year, month, day, hour, minute, second, millisecond, isUtc), int);
279 } 279 }
280 get timeZoneName() { 280 get timeZoneName() {
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 Duration.SECONDS_PER_HOUR = dart.notNull(Duration.SECONDS_PER_MINUTE) * dart.n otNull(Duration.MINUTES_PER_HOUR); 504 Duration.SECONDS_PER_HOUR = dart.notNull(Duration.SECONDS_PER_MINUTE) * dart.n otNull(Duration.MINUTES_PER_HOUR);
505 Duration.SECONDS_PER_DAY = dart.notNull(Duration.SECONDS_PER_HOUR) * dart.notN ull(Duration.HOURS_PER_DAY); 505 Duration.SECONDS_PER_DAY = dart.notNull(Duration.SECONDS_PER_HOUR) * dart.notN ull(Duration.HOURS_PER_DAY);
506 Duration.MINUTES_PER_DAY = dart.notNull(Duration.MINUTES_PER_HOUR) * dart.notN ull(Duration.HOURS_PER_DAY); 506 Duration.MINUTES_PER_DAY = dart.notNull(Duration.MINUTES_PER_HOUR) * dart.notN ull(Duration.HOURS_PER_DAY);
507 Duration.ZERO = new Duration({seconds: 0}); 507 Duration.ZERO = new Duration({seconds: 0});
508 let _stringToSafeString$ = dart.JsSymbol('_stringToSafeString'); 508 let _stringToSafeString$ = dart.JsSymbol('_stringToSafeString');
509 let _objectToString$ = dart.JsSymbol('_objectToString'); 509 let _objectToString$ = dart.JsSymbol('_objectToString');
510 class Error extends Object { 510 class Error extends Object {
511 Error() { 511 Error() {
512 } 512 }
513 static safeToString(object) { 513 static safeToString(object) {
514 if (dart.notNull(dart.is(object, num)) || dart.notNull(typeof object == bo olean) || dart.notNull(null === object)) { 514 if (dart.notNull(dart.is(object, num)) || dart.notNull(typeof object == 'b oolean') || dart.notNull(null === object)) {
515 return object.toString(); 515 return object.toString();
516 } 516 }
517 if (typeof object == string) { 517 if (typeof object == 'string') {
518 return _stringToSafeString(object); 518 return _stringToSafeString(object);
519 } 519 }
520 return _objectToString(object); 520 return _objectToString(object);
521 } 521 }
522 static [_stringToSafeString$](string) { 522 static [_stringToSafeString$](string) {
523 return _js_helper.jsonEncodeNative(string); 523 return _js_helper.jsonEncodeNative(string);
524 } 524 }
525 static [_objectToString$](object) { 525 static [_objectToString$](object) {
526 return _js_helper.Primitives.objectToString(object); 526 return _js_helper.Primitives.objectToString(object);
527 } 527 }
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
886 this.message = message; 886 this.message = message;
887 this.source = source; 887 this.source = source;
888 this.offset = offset; 888 this.offset = offset;
889 } 889 }
890 toString() { 890 toString() {
891 let report = "FormatException"; 891 let report = "FormatException";
892 if (dart.notNull(this.message !== null) && dart.notNull(!dart.equals("", t his.message))) { 892 if (dart.notNull(this.message !== null) && dart.notNull(!dart.equals("", t his.message))) {
893 report = `${report}: ${this.message}`; 893 report = `${report}: ${this.message}`;
894 } 894 }
895 let offset = this.offset; 895 let offset = this.offset;
896 if (!(typeof this.source == string)) { 896 if (!(typeof this.source == 'string')) {
897 if (offset !== -1) { 897 if (offset !== -1) {
898 report = ` (at offset ${offset})`; 898 report = ` (at offset ${offset})`;
899 } 899 }
900 return report; 900 return report;
901 } 901 }
902 if (offset !== -1 && (dart.notNull(offset) < 0 || offset['>'](dart.dload(t his.source, 'length')))) { 902 if (offset !== -1 && (dart.notNull(offset) < 0 || offset['>'](dart.dload(t his.source, 'length')))) {
903 offset = -1; 903 offset = -1;
904 } 904 }
905 if (offset === -1) { 905 if (offset === -1) {
906 let source = dart.as(this.source, String); 906 let source = dart.as(this.source, String);
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
1192 let growable = opts && 'growable' in opts ? opts.growable : true; 1192 let growable = opts && 'growable' in opts ? opts.growable : true;
1193 return null; 1193 return null;
1194 } 1194 }
1195 List$generate(length, generator, opts) { 1195 List$generate(length, generator, opts) {
1196 let growable = opts && 'growable' in opts ? opts.growable : true; 1196 let growable = opts && 'growable' in opts ? opts.growable : true;
1197 let result = null; 1197 let result = null;
1198 if (growable) { 1198 if (growable) {
1199 result = ((_$) => { 1199 result = ((_$) => {
1200 _$.length = length; 1200 _$.length = length;
1201 return _$; 1201 return _$;
1202 }).bind(this)(new List.from([])); 1202 }).bind(this)(new List$(E).from([]));
1203 } else { 1203 } else {
1204 result = new List(length); 1204 result = new List(length);
1205 } 1205 }
1206 for (let i = 0; dart.notNull(i) < dart.notNull(length); i = dart.notNull (i) + 1) { 1206 for (let i = 0; dart.notNull(i) < dart.notNull(length); i = dart.notNull (i) + 1) {
1207 result.set(i, generator(i)); 1207 result.set(i, generator(i));
1208 } 1208 }
1209 return result; 1209 return result;
1210 } 1210 }
1211 } 1211 }
1212 dart.defineNamedConstructor(List, 'filled'); 1212 dart.defineNamedConstructor(List, 'filled');
(...skipping 903 matching lines...) Expand 10 before | Expand all | Expand 10 after
2116 if (fragment !== null) { 2116 if (fragment !== null) {
2117 fragment = _makeFragment(fragment, 0, fragment.length); 2117 fragment = _makeFragment(fragment, 0, fragment.length);
2118 } else if (this.hasFragment) { 2118 } else if (this.hasFragment) {
2119 fragment = this.fragment; 2119 fragment = this.fragment;
2120 } 2120 }
2121 return new Uri._internal(scheme, userInfo, host, port, path, query, fragme nt); 2121 return new Uri._internal(scheme, userInfo, host, port, path, query, fragme nt);
2122 } 2122 }
2123 get pathSegments() { 2123 get pathSegments() {
2124 if (this[_pathSegments] === null) { 2124 if (this[_pathSegments] === null) {
2125 let pathToSplit = !dart.notNull(this.path.isEmpty) && this.path.codeUnit At(0) === Uri._SLASH ? this.path.substring(1) : this.path; 2125 let pathToSplit = !dart.notNull(this.path.isEmpty) && this.path.codeUnit At(0) === Uri._SLASH ? this.path.substring(1) : this.path;
2126 this[_pathSegments] = dart.as(new collection.UnmodifiableListView(dart.e quals(pathToSplit, "") ? /* Unimplemented const */new List.from([]) : pathToSpli t.split("/").map(Uri.decodeComponent).toList({growable: false})), List$(String)) ; 2126 this[_pathSegments] = dart.as(new collection.UnmodifiableListView(dart.e quals(pathToSplit, "") ? /* Unimplemented const */new List$(String).from([]) : p athToSplit.split("/").map(Uri.decodeComponent).toList({growable: false})), List$ (String));
2127 } 2127 }
2128 return this[_pathSegments]; 2128 return this[_pathSegments];
2129 } 2129 }
2130 get queryParameters() { 2130 get queryParameters() {
2131 if (this[_queryParameters] === null) { 2131 if (this[_queryParameters] === null) {
2132 this[_queryParameters] = dart.as(new collection.UnmodifiableMapView(spli tQueryString(this.query)), Map$(String, String)); 2132 this[_queryParameters] = dart.as(new collection.UnmodifiableMapView(spli tQueryString(this.query)), Map$(String, String));
2133 } 2133 }
2134 return this[_queryParameters]; 2134 return this[_queryParameters];
2135 } 2135 }
2136 static [_makePort$](port, scheme) { 2136 static [_makePort$](port, scheme) {
(...skipping 895 matching lines...) Expand 10 before | Expand all | Expand 10 after
3032 exports.StackTrace = StackTrace; 3032 exports.StackTrace = StackTrace;
3033 exports.Stopwatch = Stopwatch; 3033 exports.Stopwatch = Stopwatch;
3034 exports.String = String; 3034 exports.String = String;
3035 exports.RuneIterator = RuneIterator; 3035 exports.RuneIterator = RuneIterator;
3036 exports.StringBuffer = StringBuffer; 3036 exports.StringBuffer = StringBuffer;
3037 exports.StringSink = StringSink; 3037 exports.StringSink = StringSink;
3038 exports.Symbol = Symbol; 3038 exports.Symbol = Symbol;
3039 exports.Type = Type; 3039 exports.Type = Type;
3040 exports.Uri = Uri; 3040 exports.Uri = Uri;
3041 })(core || (core = {})); 3041 })(core || (core = {}));
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698