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

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

Issue 1752193002: Add a few more known non-null cases (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 4 years, 9 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 | « lib/runtime/dart/convert.js ('k') | lib/runtime/dart/html.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 dart_library.library('dart/core', null, /* Imports */[ 1 dart_library.library('dart/core', null, /* Imports */[
2 'dart/_runtime' 2 'dart/_runtime'
3 ], /* Lazy imports */[ 3 ], /* Lazy imports */[
4 'dart/_js_helper', 4 'dart/_js_helper',
5 'dart/_internal', 5 'dart/_internal',
6 'dart/collection', 6 'dart/collection',
7 'dart/_interceptors', 7 'dart/_interceptors',
8 'dart/convert' 8 'dart/convert'
9 ], function(exports, dart, _js_helper, _internal, collection, _interceptors, con vert) { 9 ], function(exports, dart, _js_helper, _internal, collection, _interceptors, con vert) {
10 'use strict'; 10 'use strict';
(...skipping 856 matching lines...) Expand 10 before | Expand all | Expand 10 after
867 } 867 }
868 sb.write(_symbolToString(key)); 868 sb.write(_symbolToString(key));
869 sb.write(": "); 869 sb.write(": ");
870 sb.write(Error.safeToString(value)); 870 sb.write(Error.safeToString(value));
871 i++; 871 i++;
872 }, dart.void, [Symbol, dart.dynamic])); 872 }, dart.void, [Symbol, dart.dynamic]));
873 } 873 }
874 if (this[_existingArgumentNames] == null) { 874 if (this[_existingArgumentNames] == null) {
875 return `NoSuchMethodError : method not found: '${this[_memberName]}'\n` + `Receiver: ${Error.safeToString(this[_receiver])}\n` + `Arguments: [${sb}]`; 875 return `NoSuchMethodError : method not found: '${this[_memberName]}'\n` + `Receiver: ${Error.safeToString(this[_receiver])}\n` + `Arguments: [${sb}]`;
876 } else { 876 } else {
877 let actualParameters = dart.toString(sb); 877 let actualParameters = sb.toString();
878 sb = new StringBuffer(); 878 sb = new StringBuffer();
879 for (let i = 0; i < dart.notNull(this[_existingArgumentNames][dartx.leng th]); i++) { 879 for (let i = 0; i < dart.notNull(this[_existingArgumentNames][dartx.leng th]); i++) {
880 if (i > 0) { 880 if (i > 0) {
881 sb.write(", "); 881 sb.write(", ");
882 } 882 }
883 sb.write(this[_existingArgumentNames][dartx.get](i)); 883 sb.write(this[_existingArgumentNames][dartx.get](i));
884 } 884 }
885 let formalParameters = dart.toString(sb); 885 let formalParameters = sb.toString();
886 return "NoSuchMethodError: incorrect number of arguments passed to " + ` method named '${this[_memberName]}'\n` + `Receiver: ${Error.safeToString(this[_r eceiver])}\n` + `Tried calling: ${this[_memberName]}(${actualParameters})\n` + ` Found: ${this[_memberName]}(${formalParameters})`; 886 return "NoSuchMethodError: incorrect number of arguments passed to " + ` method named '${this[_memberName]}'\n` + `Receiver: ${Error.safeToString(this[_r eceiver])}\n` + `Tried calling: ${this[_memberName]}(${actualParameters})\n` + ` Found: ${this[_memberName]}(${formalParameters})`;
887 } 887 }
888 } 888 }
889 } 889 }
890 dart.setSignature(NoSuchMethodError, { 890 dart.setSignature(NoSuchMethodError, {
891 constructors: () => ({NoSuchMethodError: [NoSuchMethodError, [Object, Symbol , List, Map$(Symbol, dart.dynamic)], [List]]}) 891 constructors: () => ({NoSuchMethodError: [NoSuchMethodError, [Object, Symbol , List, Map$(Symbol, dart.dynamic)], [List]]})
892 }); 892 });
893 class UnsupportedError extends Error { 893 class UnsupportedError extends Error {
894 UnsupportedError(message) { 894 UnsupportedError(message) {
895 this.message = message; 895 this.message = message;
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
1220 if (dart.notNull(count) <= 0) return new (_internal.EmptyIterable$(E))() ; 1220 if (dart.notNull(count) <= 0) return new (_internal.EmptyIterable$(E))() ;
1221 return new (exports._GeneratorIterable$(E))(count, generator); 1221 return new (exports._GeneratorIterable$(E))(count, generator);
1222 } 1222 }
1223 [dart.JsSymbol.iterator]() { 1223 [dart.JsSymbol.iterator]() {
1224 return new dart.JsIterator(this[dartx.iterator]); 1224 return new dart.JsIterator(this[dartx.iterator]);
1225 } 1225 }
1226 [dartx.join](separator) { 1226 [dartx.join](separator) {
1227 if (separator === void 0) separator = ""; 1227 if (separator === void 0) separator = "";
1228 let buffer = new StringBuffer(); 1228 let buffer = new StringBuffer();
1229 buffer.writeAll(this, separator); 1229 buffer.writeAll(this, separator);
1230 return dart.toString(buffer); 1230 return buffer.toString();
1231 } 1231 }
1232 } 1232 }
1233 dart.setSignature(Iterable, { 1233 dart.setSignature(Iterable, {
1234 constructors: () => ({ 1234 constructors: () => ({
1235 Iterable: [Iterable$(E), []], 1235 Iterable: [Iterable$(E), []],
1236 generate: [Iterable$(E), [int], [dart.functionType(E, [int])]] 1236 generate: [Iterable$(E), [int], [dart.functionType(E, [int])]]
1237 }), 1237 }),
1238 methods: () => ({[dartx.join]: [String, [], [String]]}) 1238 methods: () => ({[dartx.join]: [String, [], [String]]})
1239 }); 1239 });
1240 return Iterable; 1240 return Iterable;
(...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after
1892 const _hasDotSegments = dart.JsSymbol('_hasDotSegments'); 1892 const _hasDotSegments = dart.JsSymbol('_hasDotSegments');
1893 const _removeDotSegments = dart.JsSymbol('_removeDotSegments'); 1893 const _removeDotSegments = dart.JsSymbol('_removeDotSegments');
1894 const _toWindowsFilePath = dart.JsSymbol('_toWindowsFilePath'); 1894 const _toWindowsFilePath = dart.JsSymbol('_toWindowsFilePath');
1895 const _toFilePath = dart.JsSymbol('_toFilePath'); 1895 const _toFilePath = dart.JsSymbol('_toFilePath');
1896 const _isPathAbsolute = dart.JsSymbol('_isPathAbsolute'); 1896 const _isPathAbsolute = dart.JsSymbol('_isPathAbsolute');
1897 class Uri extends Object { 1897 class Uri extends Object {
1898 get authority() { 1898 get authority() {
1899 if (!dart.notNull(this.hasAuthority)) return ""; 1899 if (!dart.notNull(this.hasAuthority)) return "";
1900 let sb = new StringBuffer(); 1900 let sb = new StringBuffer();
1901 this[_writeAuthority](sb); 1901 this[_writeAuthority](sb);
1902 return dart.toString(sb); 1902 return sb.toString();
1903 } 1903 }
1904 get userInfo() { 1904 get userInfo() {
1905 return this[_userInfo]; 1905 return this[_userInfo];
1906 } 1906 }
1907 get host() { 1907 get host() {
1908 if (this[_host] == null) return ""; 1908 if (this[_host] == null) return "";
1909 if (dart.notNull(this[_host][dartx.startsWith]('['))) { 1909 if (dart.notNull(this[_host][dartx.startsWith]('['))) {
1910 return this[_host][dartx.substring](1, dart.notNull(this[_host][dartx.le ngth]) - 1); 1910 return this[_host][dartx.substring](1, dart.notNull(this[_host][dartx.le ngth]) - 1);
1911 } 1911 }
1912 return this[_host]; 1912 return this[_host];
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
2214 dart.throw(new UnsupportedError("Illegal character in path")); 2214 dart.throw(new UnsupportedError("Illegal character in path"));
2215 } 2215 }
2216 } 2216 }
2217 }, dart.void, [String])); 2217 }, dart.void, [String]));
2218 } 2218 }
2219 static _checkWindowsDriveLetter(charCode, argumentError) { 2219 static _checkWindowsDriveLetter(charCode, argumentError) {
2220 if (dart.notNull(Uri._UPPER_CASE_A) <= dart.notNull(charCode) && dart.notN ull(charCode) <= dart.notNull(Uri._UPPER_CASE_Z) || dart.notNull(Uri._LOWER_CASE _A) <= dart.notNull(charCode) && dart.notNull(charCode) <= dart.notNull(Uri._LOW ER_CASE_Z)) { 2220 if (dart.notNull(Uri._UPPER_CASE_A) <= dart.notNull(charCode) && dart.notN ull(charCode) <= dart.notNull(Uri._UPPER_CASE_Z) || dart.notNull(Uri._LOWER_CASE _A) <= dart.notNull(charCode) && dart.notNull(charCode) <= dart.notNull(Uri._LOW ER_CASE_Z)) {
2221 return; 2221 return;
2222 } 2222 }
2223 if (dart.notNull(argumentError)) { 2223 if (dart.notNull(argumentError)) {
2224 dart.throw(new ArgumentError("Illegal drive letter " + dart.notNull(Stri ng.fromCharCode(charCode)))); 2224 dart.throw(new ArgumentError("Illegal drive letter " + String.fromCharCo de(charCode)));
2225 } else { 2225 } else {
2226 dart.throw(new UnsupportedError("Illegal drive letter " + dart.notNull(S tring.fromCharCode(charCode)))); 2226 dart.throw(new UnsupportedError("Illegal drive letter " + String.fromCha rCode(charCode)));
2227 } 2227 }
2228 } 2228 }
2229 static _makeFileUri(path) { 2229 static _makeFileUri(path) {
2230 let sep = "/"; 2230 let sep = "/";
2231 if (dart.notNull(path[dartx.startsWith](sep))) { 2231 if (dart.notNull(path[dartx.startsWith](sep))) {
2232 return Uri.new({scheme: "file", pathSegments: path[dartx.split](sep)}); 2232 return Uri.new({scheme: "file", pathSegments: path[dartx.split](sep)});
2233 } else { 2233 } else {
2234 return Uri.new({pathSegments: path[dartx.split](sep)}); 2234 return Uri.new({pathSegments: path[dartx.split](sep)});
2235 } 2235 }
2236 } 2236 }
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
2495 if (!first) { 2495 if (!first) {
2496 result.write("&"); 2496 result.write("&");
2497 } 2497 }
2498 first = false; 2498 first = false;
2499 result.write(Uri.encodeQueryComponent(key)); 2499 result.write(Uri.encodeQueryComponent(key));
2500 if (value != null && !dart.notNull(value[dartx.isEmpty])) { 2500 if (value != null && !dart.notNull(value[dartx.isEmpty])) {
2501 result.write("="); 2501 result.write("=");
2502 result.write(Uri.encodeQueryComponent(value)); 2502 result.write(Uri.encodeQueryComponent(value));
2503 } 2503 }
2504 }, dart.void, [String, String])); 2504 }, dart.void, [String, String]));
2505 return dart.toString(result); 2505 return result.toString();
2506 } 2506 }
2507 static _makeFragment(fragment, start, end) { 2507 static _makeFragment(fragment, start, end) {
2508 if (fragment == null) return null; 2508 if (fragment == null) return null;
2509 return Uri._normalize(fragment, start, end, dart.as(Uri._queryCharTable, L ist$(int))); 2509 return Uri._normalize(fragment, start, end, dart.as(Uri._queryCharTable, L ist$(int)));
2510 } 2510 }
2511 static _stringOrNullLength(s) { 2511 static _stringOrNullLength(s) {
2512 return s == null ? 0 : s[dartx.length]; 2512 return s == null ? 0 : s[dartx.length];
2513 } 2513 }
2514 static _isHexDigit(char) { 2514 static _isHexDigit(char) {
2515 if (dart.notNull(Uri._NINE) >= dart.notNull(char)) return dart.notNull(Uri ._ZERO) <= dart.notNull(char); 2515 if (dart.notNull(Uri._NINE) >= dart.notNull(char)) return dart.notNull(Uri ._ZERO) <= dart.notNull(char);
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
2778 return dart.notNull(windows) ? this[_toWindowsFilePath]() : this[_toFilePa th](); 2778 return dart.notNull(windows) ? this[_toWindowsFilePath]() : this[_toFilePa th]();
2779 } 2779 }
2780 [_toFilePath]() { 2780 [_toFilePath]() {
2781 if (this.host != "") { 2781 if (this.host != "") {
2782 dart.throw(new UnsupportedError("Cannot extract a non-Windows file path from a file URI " + "with an authority")); 2782 dart.throw(new UnsupportedError("Cannot extract a non-Windows file path from a file URI " + "with an authority"));
2783 } 2783 }
2784 Uri._checkNonWindowsPathReservedCharacters(this.pathSegments, false); 2784 Uri._checkNonWindowsPathReservedCharacters(this.pathSegments, false);
2785 let result = new StringBuffer(); 2785 let result = new StringBuffer();
2786 if (dart.notNull(this[_isPathAbsolute])) result.write("/"); 2786 if (dart.notNull(this[_isPathAbsolute])) result.write("/");
2787 result.writeAll(this.pathSegments, "/"); 2787 result.writeAll(this.pathSegments, "/");
2788 return dart.toString(result); 2788 return result.toString();
2789 } 2789 }
2790 [_toWindowsFilePath]() { 2790 [_toWindowsFilePath]() {
2791 let hasDriveLetter = false; 2791 let hasDriveLetter = false;
2792 let segments = this.pathSegments; 2792 let segments = this.pathSegments;
2793 if (dart.notNull(segments[dartx.length]) > 0 && segments[dartx.get](0)[dar tx.length] == 2 && segments[dartx.get](0)[dartx.codeUnitAt](1) == Uri._COLON) { 2793 if (dart.notNull(segments[dartx.length]) > 0 && segments[dartx.get](0)[dar tx.length] == 2 && segments[dartx.get](0)[dartx.codeUnitAt](1) == Uri._COLON) {
2794 Uri._checkWindowsDriveLetter(segments[dartx.get](0)[dartx.codeUnitAt](0) , false); 2794 Uri._checkWindowsDriveLetter(segments[dartx.get](0)[dartx.codeUnitAt](0) , false);
2795 Uri._checkWindowsPathReservedCharacters(segments, false, 1); 2795 Uri._checkWindowsPathReservedCharacters(segments, false, 1);
2796 hasDriveLetter = true; 2796 hasDriveLetter = true;
2797 } else { 2797 } else {
2798 Uri._checkWindowsPathReservedCharacters(segments, false); 2798 Uri._checkWindowsPathReservedCharacters(segments, false);
2799 } 2799 }
2800 let result = new StringBuffer(); 2800 let result = new StringBuffer();
2801 if (dart.notNull(this[_isPathAbsolute]) && !hasDriveLetter) result.write(" \\"); 2801 if (dart.notNull(this[_isPathAbsolute]) && !hasDriveLetter) result.write(" \\");
2802 if (this.host != "") { 2802 if (this.host != "") {
2803 result.write("\\"); 2803 result.write("\\");
2804 result.write(this.host); 2804 result.write(this.host);
2805 result.write("\\"); 2805 result.write("\\");
2806 } 2806 }
2807 result.writeAll(segments, "\\"); 2807 result.writeAll(segments, "\\");
2808 if (hasDriveLetter && segments[dartx.length] == 1) result.write("\\"); 2808 if (hasDriveLetter && segments[dartx.length] == 1) result.write("\\");
2809 return dart.toString(result); 2809 return result.toString();
2810 } 2810 }
2811 get [_isPathAbsolute]() { 2811 get [_isPathAbsolute]() {
2812 if (this.path == null || dart.notNull(this.path[dartx.isEmpty])) return fa lse; 2812 if (this.path == null || dart.notNull(this.path[dartx.isEmpty])) return fa lse;
2813 return this.path[dartx.startsWith]('/'); 2813 return this.path[dartx.startsWith]('/');
2814 } 2814 }
2815 [_writeAuthority](ss) { 2815 [_writeAuthority](ss) {
2816 if (dart.notNull(this[_userInfo][dartx.isNotEmpty])) { 2816 if (dart.notNull(this[_userInfo][dartx.isNotEmpty])) {
2817 ss.write(this[_userInfo]); 2817 ss.write(this[_userInfo]);
2818 ss.write("@"); 2818 ss.write("@");
2819 } 2819 }
(...skipping 12 matching lines...) Expand all
2832 } 2832 }
2833 sb.write(this.path); 2833 sb.write(this.path);
2834 if (this[_query] != null) { 2834 if (this[_query] != null) {
2835 sb.write("?"); 2835 sb.write("?");
2836 sb.write(this[_query]); 2836 sb.write(this[_query]);
2837 } 2837 }
2838 if (this[_fragment] != null) { 2838 if (this[_fragment] != null) {
2839 sb.write("#"); 2839 sb.write("#");
2840 sb.write(this[_fragment]); 2840 sb.write(this[_fragment]);
2841 } 2841 }
2842 return dart.toString(sb); 2842 return sb.toString();
2843 } 2843 }
2844 ['=='](other) { 2844 ['=='](other) {
2845 if (!dart.is(other, Uri)) return false; 2845 if (!dart.is(other, Uri)) return false;
2846 let uri = dart.as(other, Uri); 2846 let uri = dart.as(other, Uri);
2847 return this.scheme == uri.scheme && this.hasAuthority == uri.hasAuthority && this.userInfo == uri.userInfo && this.host == uri.host && this.port == uri.po rt && this.path == uri.path && this.hasQuery == uri.hasQuery && this.query == ur i.query && this.hasFragment == uri.hasFragment && this.fragment == uri.fragment; 2847 return this.scheme == uri.scheme && this.hasAuthority == uri.hasAuthority && this.userInfo == uri.userInfo && this.host == uri.host && this.port == uri.po rt && this.path == uri.path && this.hasQuery == uri.hasQuery && this.query == ur i.query && this.hasFragment == uri.hasFragment && this.fragment == uri.fragment;
2848 } 2848 }
2849 get hashCode() { 2849 get hashCode() {
2850 function combine(part, current) { 2850 function combine(part, current) {
2851 return dart.as(dart.dsend(dart.dsend(dart.dsend(current, '*', 31), '+', dart.hashCode(part)), '&', 1073741823), int); 2851 return dart.as(dart.dsend(dart.dsend(dart.dsend(current, '*', 31), '+', dart.hashCode(part)), '&', 1073741823), int);
2852 } 2852 }
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
3018 let byte = bytes[dartx.get](i); 3018 let byte = bytes[dartx.get](i);
3019 if (dart.notNull(byte) < 128 && (dart.notNull(canonicalTable[dartx.get]( dart.notNull(byte) >> 4)) & 1 << (dart.notNull(byte) & 15)) != 0) { 3019 if (dart.notNull(byte) < 128 && (dart.notNull(canonicalTable[dartx.get]( dart.notNull(byte) >> 4)) & 1 << (dart.notNull(byte) & 15)) != 0) {
3020 result.writeCharCode(byte); 3020 result.writeCharCode(byte);
3021 } else if (dart.notNull(spaceToPlus) && byte == Uri._SPACE) { 3021 } else if (dart.notNull(spaceToPlus) && byte == Uri._SPACE) {
3022 result.writeCharCode(Uri._PLUS); 3022 result.writeCharCode(Uri._PLUS);
3023 } else { 3023 } else {
3024 result.writeCharCode(Uri._PERCENT); 3024 result.writeCharCode(Uri._PERCENT);
3025 byteToHex(byte, result); 3025 byteToHex(byte, result);
3026 } 3026 }
3027 } 3027 }
3028 return dart.toString(result); 3028 return result.toString();
3029 } 3029 }
3030 static _hexCharPairToByte(s, pos) { 3030 static _hexCharPairToByte(s, pos) {
3031 let byte = 0; 3031 let byte = 0;
3032 for (let i = 0; i < 2; i++) { 3032 for (let i = 0; i < 2; i++) {
3033 let charCode = s[dartx.codeUnitAt](dart.notNull(pos) + i); 3033 let charCode = s[dartx.codeUnitAt](dart.notNull(pos) + i);
3034 if (48 <= dart.notNull(charCode) && dart.notNull(charCode) <= 57) { 3034 if (48 <= dart.notNull(charCode) && dart.notNull(charCode) <= 57) {
3035 byte = byte * 16 + dart.notNull(charCode) - 48; 3035 byte = byte * 16 + dart.notNull(charCode) - 48;
3036 } else { 3036 } else {
3037 charCode = dart.notNull(charCode) | 32; 3037 charCode = dart.notNull(charCode) | 32;
3038 if (97 <= dart.notNull(charCode) && dart.notNull(charCode) <= 102) { 3038 if (97 <= dart.notNull(charCode) && dart.notNull(charCode) <= 102) {
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
3256 exports.StackTrace = StackTrace; 3256 exports.StackTrace = StackTrace;
3257 exports.Stopwatch = Stopwatch; 3257 exports.Stopwatch = Stopwatch;
3258 exports.String = String; 3258 exports.String = String;
3259 exports.RuneIterator = RuneIterator; 3259 exports.RuneIterator = RuneIterator;
3260 exports.StringBuffer = StringBuffer; 3260 exports.StringBuffer = StringBuffer;
3261 exports.StringSink = StringSink; 3261 exports.StringSink = StringSink;
3262 exports.Symbol = Symbol; 3262 exports.Symbol = Symbol;
3263 exports.Type = Type; 3263 exports.Type = Type;
3264 exports.Uri = Uri; 3264 exports.Uri = Uri;
3265 }); 3265 });
OLDNEW
« no previous file with comments | « lib/runtime/dart/convert.js ('k') | lib/runtime/dart/html.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698