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

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

Issue 1099813006: fixes #146, JS globals were not understood by the renamer (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 let name = this.constructor.name; 6 let name = this.constructor.name;
7 let init = this[name]; 7 let init = this[name];
8 let result = void 0; 8 let result = void 0;
9 if (init) 9 if (init)
10 result = init.apply(this, arguments); 10 result = init.apply(this, arguments);
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 let Comparator = Comparator$(); 93 let Comparator = Comparator$();
94 let Comparable$ = dart.generic(function(T) { 94 let Comparable$ = dart.generic(function(T) {
95 class Comparable extends Object { 95 class Comparable extends Object {
96 static compare(a, b) { 96 static compare(a, b) {
97 return a.compareTo(b); 97 return a.compareTo(b);
98 } 98 }
99 } 99 }
100 return Comparable; 100 return Comparable;
101 }); 101 });
102 let Comparable = Comparable$(); 102 let Comparable = Comparable$();
103 let _internal = dart.JsSymbol('_internal'); 103 let _internal$ = dart.JsSymbol('_internal');
104 let _now = dart.JsSymbol('_now'); 104 let _now = dart.JsSymbol('_now');
105 let _brokenDownDateToMillisecondsSinceEpoch = dart.JsSymbol('_brokenDownDateTo MillisecondsSinceEpoch'); 105 let _brokenDownDateToMillisecondsSinceEpoch = dart.JsSymbol('_brokenDownDateTo MillisecondsSinceEpoch');
106 let _MAX_MILLISECONDS_SINCE_EPOCH = dart.JsSymbol('_MAX_MILLISECONDS_SINCE_EPO CH'); 106 let _MAX_MILLISECONDS_SINCE_EPOCH = dart.JsSymbol('_MAX_MILLISECONDS_SINCE_EPO CH');
107 let _fourDigits = dart.JsSymbol('_fourDigits'); 107 let _fourDigits = dart.JsSymbol('_fourDigits');
108 let _sixDigits = dart.JsSymbol('_sixDigits'); 108 let _sixDigits = dart.JsSymbol('_sixDigits');
109 let _threeDigits = dart.JsSymbol('_threeDigits'); 109 let _threeDigits = dart.JsSymbol('_threeDigits');
110 let _twoDigits = dart.JsSymbol('_twoDigits'); 110 let _twoDigits = dart.JsSymbol('_twoDigits');
111 class DateTime extends Object { 111 class DateTime extends Object {
112 DateTime(year, month, day, hour, minute, second, millisecond) { 112 DateTime(year, month, day, hour, minute, second, millisecond) {
113 if (month === void 0) 113 if (month === void 0)
114 month = 1; 114 month = 1;
115 if (day === void 0) 115 if (day === void 0)
116 day = 1; 116 day = 1;
117 if (hour === void 0) 117 if (hour === void 0)
118 hour = 0; 118 hour = 0;
119 if (minute === void 0) 119 if (minute === void 0)
120 minute = 0; 120 minute = 0;
121 if (second === void 0) 121 if (second === void 0)
122 second = 0; 122 second = 0;
123 if (millisecond === void 0) 123 if (millisecond === void 0)
124 millisecond = 0; 124 millisecond = 0;
125 this[_internal](year, month, day, hour, minute, second, millisecond, false ); 125 this[_internal$](year, month, day, hour, minute, second, millisecond, fals e);
126 } 126 }
127 utc(year, month, day, hour, minute, second, millisecond) { 127 utc(year, month, day, hour, minute, second, millisecond) {
128 if (month === void 0) 128 if (month === void 0)
129 month = 1; 129 month = 1;
130 if (day === void 0) 130 if (day === void 0)
131 day = 1; 131 day = 1;
132 if (hour === void 0) 132 if (hour === void 0)
133 hour = 0; 133 hour = 0;
134 if (minute === void 0) 134 if (minute === void 0)
135 minute = 0; 135 minute = 0;
136 if (second === void 0) 136 if (second === void 0)
137 second = 0; 137 second = 0;
138 if (millisecond === void 0) 138 if (millisecond === void 0)
139 millisecond = 0; 139 millisecond = 0;
140 this[_internal](year, month, day, hour, minute, second, millisecond, true) ; 140 this[_internal$](year, month, day, hour, minute, second, millisecond, true );
141 } 141 }
142 now() { 142 now() {
143 this[_now](); 143 this[_now]();
144 } 144 }
145 static parse(formattedString) { 145 static parse(formattedString) {
146 let re = new RegExp('^([+-]?\\d{4,6})-?(\\d\\d)-?(\\d\\d)' + '(?:[ T](\\d\ \d)(?::?(\\d\\d)(?::?(\\d\\d)(.\\d{1,6})?)?)?' + '( ?[zZ]| ?([-+])(\\d\\d)(?::?( \\d\\d))?)?)?$'); 146 let re = new RegExp('^([+-]?\\d{4,6})-?(\\d\\d)-?(\\d\\d)' + '(?:[ T](\\d\ \d)(?::?(\\d\\d)(?::?(\\d\\d)(.\\d{1,6})?)?)?' + '( ?[zZ]| ?([-+])(\\d\\d)(?::?( \\d\\d))?)?)?$');
147 let match = re.firstMatch(formattedString); 147 let match = re.firstMatch(formattedString);
148 if (match != null) { 148 if (match != null) {
149 // Function parseIntOrZero: (String) → int 149 // Function parseIntOrZero: (String) → int
150 function parseIntOrZero(matched) { 150 function parseIntOrZero(matched) {
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 } 299 }
300 subtract(duration) { 300 subtract(duration) {
301 let ms = this.millisecondsSinceEpoch; 301 let ms = this.millisecondsSinceEpoch;
302 return new DateTime.fromMillisecondsSinceEpoch(dart.notNull(ms) - dart.not Null(duration.inMilliseconds), {isUtc: this.isUtc}); 302 return new DateTime.fromMillisecondsSinceEpoch(dart.notNull(ms) - dart.not Null(duration.inMilliseconds), {isUtc: this.isUtc});
303 } 303 }
304 difference(other) { 304 difference(other) {
305 let ms = this.millisecondsSinceEpoch; 305 let ms = this.millisecondsSinceEpoch;
306 let otherMs = other.millisecondsSinceEpoch; 306 let otherMs = other.millisecondsSinceEpoch;
307 return new Duration({milliseconds: dart.notNull(ms) - dart.notNull(otherMs )}); 307 return new Duration({milliseconds: dart.notNull(ms) - dart.notNull(otherMs )});
308 } 308 }
309 [_internal](year, month, day, hour, minute, second, millisecond, isUtc) { 309 [_internal$](year, month, day, hour, minute, second, millisecond, isUtc) {
310 this.isUtc = typeof isUtc == 'boolean' ? isUtc : dart.throw_(new ArgumentE rror(isUtc)); 310 this.isUtc = typeof isUtc == 'boolean' ? isUtc : dart.throw_(new ArgumentE rror(isUtc));
311 this.millisecondsSinceEpoch = dart.as(_js_helper.checkInt(_js_helper.Primi tives.valueFromDecomposedDate(year, month, day, hour, minute, second, millisecon d, isUtc)), int); 311 this.millisecondsSinceEpoch = dart.as(_js_helper.checkInt(_js_helper.Primi tives.valueFromDecomposedDate(year, month, day, hour, minute, second, millisecon d, isUtc)), int);
312 } 312 }
313 [_now]() { 313 [_now]() {
314 this.isUtc = false; 314 this.isUtc = false;
315 this.millisecondsSinceEpoch = _js_helper.Primitives.dateNow(); 315 this.millisecondsSinceEpoch = _js_helper.Primitives.dateNow();
316 } 316 }
317 static [_brokenDownDateToMillisecondsSinceEpoch](year, month, day, hour, min ute, second, millisecond, isUtc) { 317 static [_brokenDownDateToMillisecondsSinceEpoch](year, month, day, hour, min ute, second, millisecond, isUtc) {
318 return dart.as(_js_helper.Primitives.valueFromDecomposedDate(year, month, day, hour, minute, second, millisecond, isUtc), int); 318 return dart.as(_js_helper.Primitives.valueFromDecomposedDate(year, month, day, hour, minute, second, millisecond, isUtc), int);
319 } 319 }
(...skipping 29 matching lines...) Expand all
349 return dart.as(_js_helper.Primitives.getMilliseconds(this), int); 349 return dart.as(_js_helper.Primitives.getMilliseconds(this), int);
350 } 350 }
351 get weekday() { 351 get weekday() {
352 return dart.as(_js_helper.Primitives.getWeekday(this), int); 352 return dart.as(_js_helper.Primitives.getWeekday(this), int);
353 } 353 }
354 } 354 }
355 DateTime[dart.implements] = () => [Comparable]; 355 DateTime[dart.implements] = () => [Comparable];
356 dart.defineNamedConstructor(DateTime, 'utc'); 356 dart.defineNamedConstructor(DateTime, 'utc');
357 dart.defineNamedConstructor(DateTime, 'now'); 357 dart.defineNamedConstructor(DateTime, 'now');
358 dart.defineNamedConstructor(DateTime, 'fromMillisecondsSinceEpoch'); 358 dart.defineNamedConstructor(DateTime, 'fromMillisecondsSinceEpoch');
359 dart.defineNamedConstructor(DateTime, _internal); 359 dart.defineNamedConstructor(DateTime, _internal$);
360 dart.defineNamedConstructor(DateTime, _now); 360 dart.defineNamedConstructor(DateTime, _now);
361 DateTime.MONDAY = 1; 361 DateTime.MONDAY = 1;
362 DateTime.TUESDAY = 2; 362 DateTime.TUESDAY = 2;
363 DateTime.WEDNESDAY = 3; 363 DateTime.WEDNESDAY = 3;
364 DateTime.THURSDAY = 4; 364 DateTime.THURSDAY = 4;
365 DateTime.FRIDAY = 5; 365 DateTime.FRIDAY = 5;
366 DateTime.SATURDAY = 6; 366 DateTime.SATURDAY = 6;
367 DateTime.SUNDAY = 7; 367 DateTime.SUNDAY = 7;
368 DateTime.DAYS_PER_WEEK = 7; 368 DateTime.DAYS_PER_WEEK = 7;
369 DateTime.JANUARY = 1; 369 DateTime.JANUARY = 1;
(...skipping 1588 matching lines...) Expand 10 before | Expand all | Expand 10 after
1958 let numberSignIndex = uri.indexOf('#', dart.notNull(index) + 1); 1958 let numberSignIndex = uri.indexOf('#', dart.notNull(index) + 1);
1959 if (dart.notNull(numberSignIndex) < 0) { 1959 if (dart.notNull(numberSignIndex) < 0) {
1960 query = Uri[_makeQuery](uri, dart.notNull(index) + 1, uri.length, null ); 1960 query = Uri[_makeQuery](uri, dart.notNull(index) + 1, uri.length, null );
1961 } else { 1961 } else {
1962 query = Uri[_makeQuery](uri, dart.notNull(index) + 1, numberSignIndex, null); 1962 query = Uri[_makeQuery](uri, dart.notNull(index) + 1, numberSignIndex, null);
1963 fragment = Uri[_makeFragment](uri, dart.notNull(numberSignIndex) + 1, uri.length); 1963 fragment = Uri[_makeFragment](uri, dart.notNull(numberSignIndex) + 1, uri.length);
1964 } 1964 }
1965 } else if (char == Uri[_NUMBER_SIGN]) { 1965 } else if (char == Uri[_NUMBER_SIGN]) {
1966 fragment = Uri[_makeFragment](uri, dart.notNull(index) + 1, uri.length); 1966 fragment = Uri[_makeFragment](uri, dart.notNull(index) + 1, uri.length);
1967 } 1967 }
1968 return new Uri[_internal](scheme, userinfo, host, port, path, query, fragm ent); 1968 return new Uri[_internal$](scheme, userinfo, host, port, path, query, frag ment);
1969 } 1969 }
1970 static [_fail](uri, index, message) { 1970 static [_fail](uri, index, message) {
1971 throw new FormatException(message, uri, index); 1971 throw new FormatException(message, uri, index);
1972 } 1972 }
1973 [_internal](scheme, userInfo, host, port, path, query, fragment) { 1973 [_internal$](scheme, userInfo, host, port, path, query, fragment) {
1974 this.scheme = scheme; 1974 this.scheme = scheme;
1975 this[_userInfo] = userInfo; 1975 this[_userInfo] = userInfo;
1976 this[_host] = host; 1976 this[_host] = host;
1977 this[_port] = port; 1977 this[_port] = port;
1978 this[_path] = path; 1978 this[_path] = path;
1979 this[_query] = query; 1979 this[_query] = query;
1980 this[_fragment] = fragment; 1980 this[_fragment] = fragment;
1981 this[_pathSegments] = null; 1981 this[_pathSegments] = null;
1982 this[_queryParameters] = null; 1982 this[_queryParameters] = null;
1983 } 1983 }
(...skipping 14 matching lines...) Expand all
1998 query = null; 1998 query = null;
1999 query = Uri[_makeQuery](query, 0, Uri[_stringOrNullLength](query), queryPa rameters); 1999 query = Uri[_makeQuery](query, 0, Uri[_stringOrNullLength](query), queryPa rameters);
2000 fragment = Uri[_makeFragment](fragment, 0, Uri[_stringOrNullLength](fragme nt)); 2000 fragment = Uri[_makeFragment](fragment, 0, Uri[_stringOrNullLength](fragme nt));
2001 port = Uri[_makePort](port, scheme); 2001 port = Uri[_makePort](port, scheme);
2002 let isFile = scheme == "file"; 2002 let isFile = scheme == "file";
2003 if (host == null && (dart.notNull(userInfo.isNotEmpty) || port != null || dart.notNull(isFile))) { 2003 if (host == null && (dart.notNull(userInfo.isNotEmpty) || port != null || dart.notNull(isFile))) {
2004 host = ""; 2004 host = "";
2005 } 2005 }
2006 let ensureLeadingSlash = host != null; 2006 let ensureLeadingSlash = host != null;
2007 path = Uri[_makePath](path, 0, Uri[_stringOrNullLength](path), pathSegment s, ensureLeadingSlash, isFile); 2007 path = Uri[_makePath](path, 0, Uri[_stringOrNullLength](path), pathSegment s, ensureLeadingSlash, isFile);
2008 return new Uri[_internal](scheme, userInfo, host, port, path, query, fragm ent); 2008 return new Uri[_internal$](scheme, userInfo, host, port, path, query, frag ment);
2009 } 2009 }
2010 http(authority, unencodedPath, queryParameters) { 2010 http(authority, unencodedPath, queryParameters) {
2011 if (queryParameters === void 0) 2011 if (queryParameters === void 0)
2012 queryParameters = null; 2012 queryParameters = null;
2013 return Uri[_makeHttpUri]("http", authority, unencodedPath, queryParameters ); 2013 return Uri[_makeHttpUri]("http", authority, unencodedPath, queryParameters );
2014 } 2014 }
2015 https(authority, unencodedPath, queryParameters) { 2015 https(authority, unencodedPath, queryParameters) {
2016 if (queryParameters === void 0) 2016 if (queryParameters === void 0)
2017 queryParameters = null; 2017 queryParameters = null;
2018 return Uri[_makeHttpUri]("https", authority, unencodedPath, queryParameter s); 2018 return Uri[_makeHttpUri]("https", authority, unencodedPath, queryParameter s);
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
2208 if (query != null || dart.notNull(queryParameters != null)) { 2208 if (query != null || dart.notNull(queryParameters != null)) {
2209 query = Uri[_makeQuery](query, 0, Uri[_stringOrNullLength](query), query Parameters); 2209 query = Uri[_makeQuery](query, 0, Uri[_stringOrNullLength](query), query Parameters);
2210 } else if (this.hasQuery) { 2210 } else if (this.hasQuery) {
2211 query = this.query; 2211 query = this.query;
2212 } 2212 }
2213 if (fragment != null) { 2213 if (fragment != null) {
2214 fragment = Uri[_makeFragment](fragment, 0, fragment.length); 2214 fragment = Uri[_makeFragment](fragment, 0, fragment.length);
2215 } else if (this.hasFragment) { 2215 } else if (this.hasFragment) {
2216 fragment = this.fragment; 2216 fragment = this.fragment;
2217 } 2217 }
2218 return new Uri[_internal](scheme, userInfo, host, port, path, query, fragm ent); 2218 return new Uri[_internal$](scheme, userInfo, host, port, path, query, frag ment);
2219 } 2219 }
2220 get pathSegments() { 2220 get pathSegments() {
2221 if (this[_pathSegments] == null) { 2221 if (this[_pathSegments] == null) {
2222 let pathToSplit = !dart.notNull(this.path.isEmpty) && this.path.codeUnit At(0) == Uri[_SLASH] ? this.path.substring(1) : this.path; 2222 let pathToSplit = !dart.notNull(this.path.isEmpty) && this.path.codeUnit At(0) == Uri[_SLASH] ? this.path.substring(1) : this.path;
2223 this[_pathSegments] = new collection.UnmodifiableListView(pathToSplit == "" ? /* Unimplemented const */dart.setType([], List$(String)) : pathToSplit.spl it("/")[exports.$map](Uri.decodeComponent)[exports.$toList]({growable: false})); 2223 this[_pathSegments] = new collection.UnmodifiableListView(pathToSplit == "" ? /* Unimplemented const */dart.setType([], List$(String)) : pathToSplit.spl it("/")[exports.$map](Uri.decodeComponent)[exports.$toList]({growable: false}));
2224 } 2224 }
2225 return this[_pathSegments]; 2225 return this[_pathSegments];
2226 } 2226 }
2227 get queryParameters() { 2227 get queryParameters() {
2228 if (this[_queryParameters] == null) { 2228 if (this[_queryParameters] == null) {
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
2642 } 2642 }
2643 if (reference.hasQuery) 2643 if (reference.hasQuery)
2644 targetQuery = reference.query; 2644 targetQuery = reference.query;
2645 } 2645 }
2646 targetUserInfo = this[_userInfo]; 2646 targetUserInfo = this[_userInfo];
2647 targetHost = this[_host]; 2647 targetHost = this[_host];
2648 targetPort = this[_port]; 2648 targetPort = this[_port];
2649 } 2649 }
2650 } 2650 }
2651 let fragment = reference.hasFragment ? reference.fragment : null; 2651 let fragment = reference.hasFragment ? reference.fragment : null;
2652 return new Uri[_internal](targetScheme, targetUserInfo, targetHost, target Port, targetPath, targetQuery, fragment); 2652 return new Uri[_internal$](targetScheme, targetUserInfo, targetHost, targe tPort, targetPath, targetQuery, fragment);
2653 } 2653 }
2654 get hasAuthority() { 2654 get hasAuthority() {
2655 return this[_host] != null; 2655 return this[_host] != null;
2656 } 2656 }
2657 get hasPort() { 2657 get hasPort() {
2658 return this[_port] != null; 2658 return this[_port] != null;
2659 } 2659 }
2660 get hasQuery() { 2660 get hasQuery() {
2661 return this[_query] != null; 2661 return this[_query] != null;
2662 } 2662 }
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
3002 bytes[exports.$add](codeUnit); 3002 bytes[exports.$add](codeUnit);
3003 } 3003 }
3004 } 3004 }
3005 } 3005 }
3006 return encoding.decode(bytes); 3006 return encoding.decode(bytes);
3007 } 3007 }
3008 static [_isAlphabeticCharacter](codeUnit) { 3008 static [_isAlphabeticCharacter](codeUnit) {
3009 return dart.notNull(codeUnit) >= dart.notNull(Uri[_LOWER_CASE_A]) && dart. notNull(codeUnit) <= dart.notNull(Uri[_LOWER_CASE_Z]) || dart.notNull(codeUnit) >= dart.notNull(Uri[_UPPER_CASE_A]) && dart.notNull(codeUnit) <= dart.notNull(Ur i[_UPPER_CASE_Z]); 3009 return dart.notNull(codeUnit) >= dart.notNull(Uri[_LOWER_CASE_A]) && dart. notNull(codeUnit) <= dart.notNull(Uri[_LOWER_CASE_Z]) || dart.notNull(codeUnit) >= dart.notNull(Uri[_UPPER_CASE_A]) && dart.notNull(codeUnit) <= dart.notNull(Ur i[_UPPER_CASE_Z]);
3010 } 3010 }
3011 } 3011 }
3012 dart.defineNamedConstructor(Uri, _internal); 3012 dart.defineNamedConstructor(Uri, _internal$);
3013 dart.defineNamedConstructor(Uri, 'http'); 3013 dart.defineNamedConstructor(Uri, 'http');
3014 dart.defineNamedConstructor(Uri, 'https'); 3014 dart.defineNamedConstructor(Uri, 'https');
3015 dart.defineNamedConstructor(Uri, 'file'); 3015 dart.defineNamedConstructor(Uri, 'file');
3016 Uri._SPACE = 32; 3016 Uri._SPACE = 32;
3017 Uri._DOUBLE_QUOTE = 34; 3017 Uri._DOUBLE_QUOTE = 34;
3018 Uri._NUMBER_SIGN = 35; 3018 Uri._NUMBER_SIGN = 35;
3019 Uri._PERCENT = 37; 3019 Uri._PERCENT = 37;
3020 Uri._ASTERISK = 42; 3020 Uri._ASTERISK = 42;
3021 Uri._PLUS = 43; 3021 Uri._PLUS = 43;
3022 Uri._DOT = 46; 3022 Uri._DOT = 46;
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
3151 exports.Symbol = Symbol; 3151 exports.Symbol = Symbol;
3152 exports.Type = Type; 3152 exports.Type = Type;
3153 exports.$forEach = $forEach; 3153 exports.$forEach = $forEach;
3154 exports.$map = $map; 3154 exports.$map = $map;
3155 exports.$toList = $toList; 3155 exports.$toList = $toList;
3156 exports.$isEmpty = $isEmpty; 3156 exports.$isEmpty = $isEmpty;
3157 exports.$removeLast = $removeLast; 3157 exports.$removeLast = $removeLast;
3158 exports.$fold = $fold; 3158 exports.$fold = $fold;
3159 exports.Uri = Uri; 3159 exports.Uri = Uri;
3160 })(core || (core = {})); 3160 })(core || (core = {}));
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698