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

Side by Side Diff: test/dart_codegen/expect/core/uri.dart

Issue 959003003: Typecheck constructor initializers properly (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Rebase Created 5 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 | « test/dart_codegen/expect/core/string.dart ('k') | test/dart_codegen/expect/math/point.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 part of dart.core; 1 part of dart.core;
2 class Uri {final String _host; 2 class Uri {final String _host;
3 num _port; 3 num _port;
4 String _path; 4 String _path;
5 final String scheme; 5 final String scheme;
6 String get authority { 6 String get authority {
7 if (!hasAuthority) return ""; 7 if (!hasAuthority) return "";
8 var sb = new StringBuffer(); 8 var sb = new StringBuffer();
9 _writeAuthority(sb); 9 _writeAuthority(sb);
10 return sb.toString(); 10 return sb.toString();
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 bool hasPort = false; 261 bool hasPort = false;
262 for (; hostEnd < authority.length; hostEnd++) { 262 for (; hostEnd < authority.length; hostEnd++) {
263 if (authority.codeUnitAt(hostEnd) == _COLON) { 263 if (authority.codeUnitAt(hostEnd) == _COLON) {
264 var portString = authority.substring(hostEnd + 1); 264 var portString = authority.substring(hostEnd + 1);
265 if (portString.isNotEmpty) port = int.parse(portString); 265 if (portString.isNotEmpty) port = int.parse(portString);
266 break; 266 break;
267 } 267 }
268 } 268 }
269 host = authority.substring(hostStart, hostEnd); 269 host = authority.substring(hostStart, hostEnd);
270 } 270 }
271 return new Uri(scheme: scheme, userInfo: userInfo, host: host, port: port, pa thSegments: unencodedPath.split("/"), queryParameters: queryParameters); 271 return new Uri(scheme: scheme, userInfo: userInfo, host: DDC$RT.cast(host, dy namic, String, "CastGeneral", """line 609, column 26 of dart:core/uri.dart: """, host is String, true), port: DDC$RT.cast(port, dynamic, int, "CastGeneral", """ line 610, column 26 of dart:core/uri.dart: """, port is int, true), pathSegments : unencodedPath.split("/"), queryParameters: queryParameters);
272 } 272 }
273 factory Uri.file(String path, { 273 factory Uri.file(String path, {
274 bool windows} 274 bool windows}
275 ) { 275 ) {
276 windows = windows == null ? Uri._isWindows : windows; 276 windows = windows == null ? Uri._isWindows : windows;
277 return ((__x10) => DDC$RT.cast(__x10, dynamic, Uri, "CastGeneral", """line 69 8, column 12 of dart:core/uri.dart: """, __x10 is Uri, true))(windows ? _makeWin dowsFileUrl(path) : _makeFileUri(path)); 277 return ((__x15) => DDC$RT.cast(__x15, dynamic, Uri, "CastGeneral", """line 69 8, column 12 of dart:core/uri.dart: """, __x15 is Uri, true))(windows ? _makeWin dowsFileUrl(path) : _makeFileUri(path));
278 } 278 }
279 external static Uri get base; 279 external static Uri get base;
280 external static bool get _isWindows; 280 external static bool get _isWindows;
281 static _checkNonWindowsPathReservedCharacters(List<String> segments, bool argum entError) { 281 static _checkNonWindowsPathReservedCharacters(List<String> segments, bool argum entError) {
282 segments.forEach((segment) { 282 segments.forEach((segment) {
283 if (segment.contains("/")) { 283 if (segment.contains("/")) {
284 if (argumentError) { 284 if (argumentError) {
285 throw new ArgumentError("Illegal path character $segment"); 285 throw new ArgumentError("Illegal path character $segment");
286 } 286 }
287 else { 287 else {
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 if (userInfo != null) { 384 if (userInfo != null) {
385 userInfo = _makeUserInfo(userInfo, 0, userInfo.length); 385 userInfo = _makeUserInfo(userInfo, 0, userInfo.length);
386 } 386 }
387 else { 387 else {
388 userInfo = this.userInfo; 388 userInfo = this.userInfo;
389 } 389 }
390 if (port != null) { 390 if (port != null) {
391 port = _makePort(port, scheme); 391 port = _makePort(port, scheme);
392 } 392 }
393 else { 393 else {
394 port = ((__x11) => DDC$RT.cast(__x11, num, int, "CastGeneral", """line 889, column 14 of dart:core/uri.dart: """, __x11 is int, true))(this._port); 394 port = ((__x16) => DDC$RT.cast(__x16, num, int, "CastGeneral", """line 889, column 14 of dart:core/uri.dart: """, __x16 is int, true))(this._port);
395 if (schemeChanged) { 395 if (schemeChanged) {
396 port = _makePort(port, scheme); 396 port = _makePort(port, scheme);
397 } 397 }
398 } 398 }
399 if (host != null) { 399 if (host != null) {
400 host = _makeHost(host, 0, host.length, false); 400 host = _makeHost(host, 0, host.length, false);
401 } 401 }
402 else if (this.hasAuthority) { 402 else if (this.hasAuthority) {
403 host = this.host; 403 host = this.host;
404 } 404 }
(...skipping 20 matching lines...) Expand all
425 fragment = _makeFragment(fragment, 0, fragment.length); 425 fragment = _makeFragment(fragment, 0, fragment.length);
426 } 426 }
427 else if (this.hasFragment) { 427 else if (this.hasFragment) {
428 fragment = this.fragment; 428 fragment = this.fragment;
429 } 429 }
430 return new Uri._internal(scheme, userInfo, host, port, path, query, fragment) ; 430 return new Uri._internal(scheme, userInfo, host, port, path, query, fragment) ;
431 } 431 }
432 List<String> get pathSegments { 432 List<String> get pathSegments {
433 if (_pathSegments == null) { 433 if (_pathSegments == null) {
434 var pathToSplit = !path.isEmpty && path.codeUnitAt(0) == _SLASH ? path.subst ring(1) : path; 434 var pathToSplit = !path.isEmpty && path.codeUnitAt(0) == _SLASH ? path.subst ring(1) : path;
435 _pathSegments = ((__x12) => DDC$RT.cast(__x12, DDC$RT.type((DDC$collection$ .UnmodifiableListView<dynamic> _) { 435 _pathSegments = ((__x17) => DDC$RT.cast(__x17, DDC$RT.type((DDC$collection$ .UnmodifiableListView<dynamic> _) {
436 } 436 }
437 ), DDC$RT.type((List<String> _) { 437 ), DDC$RT.type((List<String> _) {
438 } 438 }
439 ), "CastExact", """line 945, column 23 of dart:core/uri.dart: """, __x12 is List<String>, false))(new UnmodifiableListView(pathToSplit == "" ? const <String > [] : pathToSplit.split("/").map(Uri.decodeComponent).toList(growable: false))) ; 439 ), "CastExact", """line 945, column 23 of dart:core/uri.dart: """, __x17 is List<String>, false))(new UnmodifiableListView(pathToSplit == "" ? const <String > [] : pathToSplit.split("/").map(Uri.decodeComponent).toList(growable: false))) ;
440 } 440 }
441 return _pathSegments; 441 return _pathSegments;
442 } 442 }
443 Map<String, String> get queryParameters { 443 Map<String, String> get queryParameters {
444 if (_queryParameters == null) { 444 if (_queryParameters == null) {
445 _queryParameters = ((__x13) => DDC$RT.cast(__x13, DDC$RT.type((DDC$collectio n$.UnmodifiableMapView<dynamic, dynamic> _) { 445 _queryParameters = ((__x18) => DDC$RT.cast(__x18, DDC$RT.type((DDC$collectio n$.UnmodifiableMapView<dynamic, dynamic> _) {
446 } 446 }
447 ), DDC$RT.type((Map<String, String> _) { 447 ), DDC$RT.type((Map<String, String> _) {
448 } 448 }
449 ), "CastExact", """line 969, column 26 of dart:core/uri.dart: """, __x13 is Map<String, String>, false))(new UnmodifiableMapView(splitQueryString(query))); 449 ), "CastExact", """line 969, column 26 of dart:core/uri.dart: """, __x18 is Map<String, String>, false))(new UnmodifiableMapView(splitQueryString(query)));
450 } 450 }
451 return _queryParameters; 451 return _queryParameters;
452 } 452 }
453 static int _makePort(int port, String scheme) { 453 static int _makePort(int port, String scheme) {
454 if (port != null && port == _defaultPort(scheme)) return ((__x14) => DDC$RT.ca st(__x14, Null, int, "CastLiteral", """line 976, column 62 of dart:core/uri.dart : """, __x14 is int, true))(null); 454 if (port != null && port == _defaultPort(scheme)) return ((__x19) => DDC$RT.ca st(__x19, Null, int, "CastLiteral", """line 976, column 62 of dart:core/uri.dart : """, __x19 is int, true))(null);
455 return port; 455 return port;
456 } 456 }
457 static String _makeHost(String host, int start, int end, bool strictIPv6) { 457 static String _makeHost(String host, int start, int end, bool strictIPv6) {
458 if (host == null) return null; 458 if (host == null) return null;
459 if (start == end) return ""; 459 if (start == end) return "";
460 if (host.codeUnitAt(start) == _LEFT_BRACKET) { 460 if (host.codeUnitAt(start) == _LEFT_BRACKET) {
461 if (host.codeUnitAt(end - 1) != _RIGHT_BRACKET) { 461 if (host.codeUnitAt(end - 1) != _RIGHT_BRACKET) {
462 _fail(host, start, 'Missing end `]` to match `[` in host'); 462 _fail(host, start, 'Missing end `]` to match `[` in host');
463 } 463 }
464 parseIPv6Address(host, start + 1, end - 1); 464 parseIPv6Address(host, start + 1, end - 1);
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
661 } 661 }
662 static bool _isUnreservedChar(int ch) { 662 static bool _isUnreservedChar(int ch) {
663 return ch < 127 && ((_unreservedTable[ch >> 4] & (1 << (ch & 0x0f))) != 0); 663 return ch < 127 && ((_unreservedTable[ch >> 4] & (1 << (ch & 0x0f))) != 0);
664 } 664 }
665 static String _escapeChar(char) { 665 static String _escapeChar(char) {
666 assert (char <= 0x10ffff); const hexDigits = "0123456789ABCDEF"; 666 assert (char <= 0x10ffff); const hexDigits = "0123456789ABCDEF";
667 List codeUnits; 667 List codeUnits;
668 if (char < 0x80) { 668 if (char < 0x80) {
669 codeUnits = new List(3); 669 codeUnits = new List(3);
670 codeUnits[0] = _PERCENT; 670 codeUnits[0] = _PERCENT;
671 codeUnits[1] = hexDigits.codeUnitAt(((__x15) => DDC$RT.cast(__x15, dynamic, int, "CastGeneral", """line 1248, column 43 of dart:core/uri.dart: """, __x15 i s int, true))(char >> 4)); 671 codeUnits[1] = hexDigits.codeUnitAt(((__x20) => DDC$RT.cast(__x20, dynamic, int, "CastGeneral", """line 1248, column 43 of dart:core/uri.dart: """, __x20 i s int, true))(char >> 4));
672 codeUnits[2] = hexDigits.codeUnitAt(((__x16) => DDC$RT.cast(__x16, dynamic, int, "CastGeneral", """line 1249, column 43 of dart:core/uri.dart: """, __x16 i s int, true))(char & 0xf)); 672 codeUnits[2] = hexDigits.codeUnitAt(((__x21) => DDC$RT.cast(__x21, dynamic, int, "CastGeneral", """line 1249, column 43 of dart:core/uri.dart: """, __x21 i s int, true))(char & 0xf));
673 } 673 }
674 else { 674 else {
675 int flag = 0xc0; 675 int flag = 0xc0;
676 int encodedBytes = 2; 676 int encodedBytes = 2;
677 if (char > 0x7ff) { 677 if (char > 0x7ff) {
678 flag = 0xe0; 678 flag = 0xe0;
679 encodedBytes = 3; 679 encodedBytes = 3;
680 if (char > 0xffff) { 680 if (char > 0xffff) {
681 encodedBytes = 4; 681 encodedBytes = 4;
682 flag = 0xf0; 682 flag = 0xf0;
683 } 683 }
684 } 684 }
685 codeUnits = new List(3 * encodedBytes); 685 codeUnits = new List(3 * encodedBytes);
686 int index = 0; 686 int index = 0;
687 while (--encodedBytes >= 0) { 687 while (--encodedBytes >= 0) {
688 int byte = ((__x17) => DDC$RT.cast(__x17, dynamic, int, "CastGeneral", """ line 1265, column 20 of dart:core/uri.dart: """, __x17 is int, true))(((char >> (6 * encodedBytes)) & 0x3f) | flag); 688 int byte = ((__x22) => DDC$RT.cast(__x22, dynamic, int, "CastGeneral", """ line 1265, column 20 of dart:core/uri.dart: """, __x22 is int, true))(((char >> (6 * encodedBytes)) & 0x3f) | flag);
689 codeUnits[index] = _PERCENT; 689 codeUnits[index] = _PERCENT;
690 codeUnits[index + 1] = hexDigits.codeUnitAt(byte >> 4); 690 codeUnits[index + 1] = hexDigits.codeUnitAt(byte >> 4);
691 codeUnits[index + 2] = hexDigits.codeUnitAt(byte & 0xf); 691 codeUnits[index + 2] = hexDigits.codeUnitAt(byte & 0xf);
692 index += 3; 692 index += 3;
693 flag = 0x80; 693 flag = 0x80;
694 } 694 }
695 } 695 }
696 return new String.fromCharCodes(codeUnits); 696 return new String.fromCharCodes(DDC$RT.cast(codeUnits, DDC$RT.type((List<dyna mic> _) {
697 }
698 ), DDC$RT.type((Iterable<int> _) {
699 }
700 ), "CastDynamic", """line 1273, column 37 of dart:core/uri.dart: """, codeUnit s is Iterable<int>, false));
697 } 701 }
698 static String _normalize(String component, int start, int end, List<int> charTa ble) { 702 static String _normalize(String component, int start, int end, List<int> charTa ble) {
699 StringBuffer buffer; 703 StringBuffer buffer;
700 int sectionStart = start; 704 int sectionStart = start;
701 int index = start; 705 int index = start;
702 while (index < end) { 706 while (index < end) {
703 int char = component.codeUnitAt(index); 707 int char = component.codeUnitAt(index);
704 if (char < 127 && (charTable[char >> 4] & (1 << (char & 0x0f))) != 0) { 708 if (char < 127 && (charTable[char >> 4] & (1 << (char & 0x0f))) != 0) {
705 index++; 709 index++;
706 } 710 }
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
782 } 786 }
783 return base.substring(0, baseEnd + 1) + reference.substring(refStart - 3 * ba ckCount); 787 return base.substring(0, baseEnd + 1) + reference.substring(refStart - 3 * ba ckCount);
784 } 788 }
785 bool _hasDotSegments(String path) { 789 bool _hasDotSegments(String path) {
786 if (path.length > 0 && path.codeUnitAt(0) == _DOT) return true; 790 if (path.length > 0 && path.codeUnitAt(0) == _DOT) return true;
787 int index = path.indexOf("/."); 791 int index = path.indexOf("/.");
788 return index != -1; 792 return index != -1;
789 } 793 }
790 String _removeDotSegments(String path) { 794 String _removeDotSegments(String path) {
791 if (!_hasDotSegments(path)) return path; 795 if (!_hasDotSegments(path)) return path;
792 List<String> output = ((__x18) => DDC$RT.cast(__x18, DDC$RT.type((List<dynami c> _) { 796 List<String> output = ((__x23) => DDC$RT.cast(__x23, DDC$RT.type((List<dynami c> _) {
793 } 797 }
794 ), DDC$RT.type((List<String> _) { 798 ), DDC$RT.type((List<String> _) {
795 } 799 }
796 ), "CastLiteral", """line 1402, column 27 of dart:core/uri.dart: """, __x18 is List<String>, false))([]); 800 ), "CastLiteral", """line 1402, column 27 of dart:core/uri.dart: """, __x23 is List<String>, false))([]);
797 bool appendSlash = false; 801 bool appendSlash = false;
798 for (String segment in path.split("/")) { 802 for (String segment in path.split("/")) {
799 appendSlash = false; 803 appendSlash = false;
800 if (segment == "..") { 804 if (segment == "..") {
801 if (!output.isEmpty && ((output.length != 1) || (output[0] != ""))) output .removeLast(); 805 if (!output.isEmpty && ((output.length != 1) || (output[0] != ""))) output .removeLast();
802 appendSlash = true; 806 appendSlash = true;
803 } 807 }
804 else if ("." == segment) { 808 else if ("." == segment) {
805 appendSlash = true; 809 appendSlash = true;
806 } 810 }
(...skipping 12 matching lines...) Expand all
819 String targetUserInfo = ""; 823 String targetUserInfo = "";
820 String targetHost; 824 String targetHost;
821 int targetPort; 825 int targetPort;
822 String targetPath; 826 String targetPath;
823 String targetQuery; 827 String targetQuery;
824 if (reference.scheme.isNotEmpty) { 828 if (reference.scheme.isNotEmpty) {
825 targetScheme = reference.scheme; 829 targetScheme = reference.scheme;
826 if (reference.hasAuthority) { 830 if (reference.hasAuthority) {
827 targetUserInfo = reference.userInfo; 831 targetUserInfo = reference.userInfo;
828 targetHost = reference.host; 832 targetHost = reference.host;
829 targetPort = ((__x19) => DDC$RT.cast(__x19, dynamic, int, "CastGeneral", """line 1456, column 22 of dart:core/uri.dart: """, __x19 is int, true))(referen ce.hasPort ? reference.port : null); 833 targetPort = ((__x24) => DDC$RT.cast(__x24, dynamic, int, "CastGeneral", """line 1456, column 22 of dart:core/uri.dart: """, __x24 is int, true))(referen ce.hasPort ? reference.port : null);
830 } 834 }
831 targetPath = _removeDotSegments(reference.path); 835 targetPath = _removeDotSegments(reference.path);
832 if (reference.hasQuery) { 836 if (reference.hasQuery) {
833 targetQuery = reference.query; 837 targetQuery = reference.query;
834 } 838 }
835 } 839 }
836 else { 840 else {
837 targetScheme = this.scheme; 841 targetScheme = this.scheme;
838 if (reference.hasAuthority) { 842 if (reference.hasAuthority) {
839 targetUserInfo = reference.userInfo; 843 targetUserInfo = reference.userInfo;
840 targetHost = reference.host; 844 targetHost = reference.host;
841 targetPort = _makePort(((__x20) => DDC$RT.cast(__x20, dynamic, int, "Cast General", """line 1467, column 32 of dart:core/uri.dart: """, __x20 is int, true ))(reference.hasPort ? reference.port : null), targetScheme); 845 targetPort = _makePort(((__x25) => DDC$RT.cast(__x25, dynamic, int, "Cast General", """line 1467, column 32 of dart:core/uri.dart: """, __x25 is int, true ))(reference.hasPort ? reference.port : null), targetScheme);
842 targetPath = _removeDotSegments(reference.path); 846 targetPath = _removeDotSegments(reference.path);
843 if (reference.hasQuery) targetQuery = reference.query; 847 if (reference.hasQuery) targetQuery = reference.query;
844 } 848 }
845 else { 849 else {
846 if (reference.path == "") { 850 if (reference.path == "") {
847 targetPath = this._path; 851 targetPath = this._path;
848 if (reference.hasQuery) { 852 if (reference.hasQuery) {
849 targetQuery = reference.query; 853 targetQuery = reference.query;
850 } 854 }
851 else { 855 else {
852 targetQuery = this._query; 856 targetQuery = this._query;
853 } 857 }
854 } 858 }
855 else { 859 else {
856 if (reference.path.startsWith("/")) { 860 if (reference.path.startsWith("/")) {
857 targetPath = _removeDotSegments(reference.path); 861 targetPath = _removeDotSegments(reference.path);
858 } 862 }
859 else { 863 else {
860 targetPath = _removeDotSegments(_merge(this._path, reference.path)); 864 targetPath = _removeDotSegments(_merge(this._path, reference.path));
861 } 865 }
862 if (reference.hasQuery) targetQuery = reference.query; 866 if (reference.hasQuery) targetQuery = reference.query;
863 } 867 }
864 targetUserInfo = this._userInfo; 868 targetUserInfo = this._userInfo;
865 targetHost = this._host; 869 targetHost = this._host;
866 targetPort = ((__x21) => DDC$RT.cast(__x21, num, int, "CastGeneral", """l ine 1489, column 22 of dart:core/uri.dart: """, __x21 is int, true))(this._port) ; 870 targetPort = ((__x26) => DDC$RT.cast(__x26, num, int, "CastGeneral", """l ine 1489, column 22 of dart:core/uri.dart: """, __x26 is int, true))(this._port) ;
867 } 871 }
868 } 872 }
869 String fragment = ((__x22) => DDC$RT.cast(__x22, dynamic, String, "CastGenera l", """line 1492, column 23 of dart:core/uri.dart: """, __x22 is String, true))( reference.hasFragment ? reference.fragment : null); 873 String fragment = ((__x27) => DDC$RT.cast(__x27, dynamic, String, "CastGenera l", """line 1492, column 23 of dart:core/uri.dart: """, __x27 is String, true))( reference.hasFragment ? reference.fragment : null);
870 return new Uri._internal(targetScheme, targetUserInfo, targetHost, targetPort , targetPath, targetQuery, fragment); 874 return new Uri._internal(targetScheme, targetUserInfo, targetHost, targetPort , targetPath, targetQuery, fragment);
871 } 875 }
872 bool get hasAuthority => _host != null; 876 bool get hasAuthority => _host != null;
873 bool get hasPort => _port != null; 877 bool get hasPort => _port != null;
874 bool get hasQuery => _query != null; 878 bool get hasQuery => _query != null;
875 bool get hasFragment => _fragment != null; 879 bool get hasFragment => _fragment != null;
876 String get origin { 880 String get origin {
877 if (scheme == "" || _host == null || _host == "") { 881 if (scheme == "" || _host == null || _host == "") {
878 throw new StateError("Cannot use origin without a scheme: $this"); 882 throw new StateError("Cannot use origin without a scheme: $this");
879 } 883 }
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
961 } 965 }
962 return sb.toString(); 966 return sb.toString();
963 } 967 }
964 bool operator ==(other) { 968 bool operator ==(other) {
965 if (other is! Uri) return false; 969 if (other is! Uri) return false;
966 Uri uri = DDC$RT.cast(other, dynamic, Uri, "CastGeneral", """line 1698, colum n 15 of dart:core/uri.dart: """, other is Uri, true); 970 Uri uri = DDC$RT.cast(other, dynamic, Uri, "CastGeneral", """line 1698, colum n 15 of dart:core/uri.dart: """, other is Uri, true);
967 return scheme == uri.scheme && hasAuthority == uri.hasAuthority && userInfo = = uri.userInfo && host == uri.host && port == uri.port && path == uri.path && ha sQuery == uri.hasQuery && query == uri.query && hasFragment == uri.hasFragment & & fragment == uri.fragment; 971 return scheme == uri.scheme && hasAuthority == uri.hasAuthority && userInfo = = uri.userInfo && host == uri.host && port == uri.port && path == uri.path && ha sQuery == uri.hasQuery && query == uri.query && hasFragment == uri.hasFragment & & fragment == uri.fragment;
968 } 972 }
969 int get hashCode { 973 int get hashCode {
970 int combine(part, current) { 974 int combine(part, current) {
971 return ((__x23) => DDC$RT.cast(__x23, dynamic, int, "CastGeneral", """line 1 714, column 14 of dart:core/uri.dart: """, __x23 is int, true))((current * 31 + part.hashCode) & 0x3FFFFFFF); 975 return ((__x28) => DDC$RT.cast(__x28, dynamic, int, "CastGeneral", """line 1 714, column 14 of dart:core/uri.dart: """, __x28 is int, true))((current * 31 + part.hashCode) & 0x3FFFFFFF);
972 } 976 }
973 return combine(scheme, combine(userInfo, combine(host, combine(port, combine( path, combine(query, combine(fragment, 1))))))); 977 return combine(scheme, combine(userInfo, combine(host, combine(port, combine( path, combine(query, combine(fragment, 1)))))));
974 } 978 }
975 static void _addIfNonEmpty(StringBuffer sb, String test, String first, String s econd) { 979 static void _addIfNonEmpty(StringBuffer sb, String test, String first, String s econd) {
976 if ("" != test) { 980 if ("" != test) {
977 sb.write(first); 981 sb.write(first);
978 sb.write(second); 982 sb.write(second);
979 } 983 }
980 } 984 }
981 static String encodeComponent(String component) { 985 static String encodeComponent(String component) {
(...skipping 20 matching lines...) Expand all
1002 return _uriEncode(DDC$RT.cast(_encodeFullTable, dynamic, DDC$RT.type((List<int > _) { 1006 return _uriEncode(DDC$RT.cast(_encodeFullTable, dynamic, DDC$RT.type((List<int > _) {
1003 } 1007 }
1004 ), "CastGeneral", """line 1832, column 23 of dart:core/uri.dart: """, _encodeF ullTable is List<int>, false), uri); 1008 ), "CastGeneral", """line 1832, column 23 of dart:core/uri.dart: """, _encodeF ullTable is List<int>, false), uri);
1005 } 1009 }
1006 static String decodeFull(String uri) { 1010 static String decodeFull(String uri) {
1007 return _uriDecode(uri); 1011 return _uriDecode(uri);
1008 } 1012 }
1009 static Map<String, String> splitQueryString(String query, { 1013 static Map<String, String> splitQueryString(String query, {
1010 Encoding encoding : UTF8} 1014 Encoding encoding : UTF8}
1011 ) { 1015 ) {
1012 return ((__x24) => DDC$RT.cast(__x24, dynamic, DDC$RT.type((Map<String, String > _) { 1016 return ((__x29) => DDC$RT.cast(__x29, dynamic, DDC$RT.type((Map<String, String > _) {
1013 } 1017 }
1014 ), "CastGeneral", """line 1864, column 12 of dart:core/uri.dart: """, __x24 is Map<String, String>, false))(query.split("&").fold({ 1018 ), "CastGeneral", """line 1864, column 12 of dart:core/uri.dart: """, __x29 is Map<String, String>, false))(query.split("&").fold({
1015 } 1019 }
1016 , (map, element) { 1020 , (map, element) {
1017 int index = ((__x25) => DDC$RT.cast(__x25, dynamic, int, "CastGeneral", """l ine 1865, column 19 of dart:core/uri.dart: """, __x25 is int, true))(element.ind exOf("=")); 1021 int index = ((__x30) => DDC$RT.cast(__x30, dynamic, int, "CastGeneral", """l ine 1865, column 19 of dart:core/uri.dart: """, __x30 is int, true))(element.ind exOf("="));
1018 if (index == -1) { 1022 if (index == -1) {
1019 if (element != "") { 1023 if (element != "") {
1020 map[decodeQueryComponent(DDC$RT.cast(element, dynamic, String, "CastGene ral", """line 1868, column 36 of dart:core/uri.dart: """, element is String, tru e), encoding: encoding)] = ""; 1024 map[decodeQueryComponent(DDC$RT.cast(element, dynamic, String, "CastGene ral", """line 1868, column 36 of dart:core/uri.dart: """, element is String, tru e), encoding: encoding)] = "";
1021 } 1025 }
1022 } 1026 }
1023 else if (index != 0) { 1027 else if (index != 0) {
1024 var key = element.substring(0, index); 1028 var key = element.substring(0, index);
1025 var value = element.substring(index + 1); 1029 var value = element.substring(index + 1);
1026 map[Uri.decodeQueryComponent(DDC$RT.cast(key, dynamic, String, "CastGener al", """line 1873, column 38 of dart:core/uri.dart: """, key is String, true), e ncoding: encoding)] = decodeQueryComponent(DDC$RT.cast(value, dynamic, String, " CastGeneral", """line 1874, column 34 of dart:core/uri.dart: """, value is Strin g, true), encoding: encoding); 1030 map[Uri.decodeQueryComponent(DDC$RT.cast(key, dynamic, String, "CastGener al", """line 1873, column 38 of dart:core/uri.dart: """, key is String, true), e ncoding: encoding)] = decodeQueryComponent(DDC$RT.cast(value, dynamic, String, " CastGeneral", """line 1874, column 34 of dart:core/uri.dart: """, value is Strin g, true), encoding: encoding);
1027 } 1031 }
1028 return map; 1032 return map;
1029 } 1033 }
1030 )); 1034 ));
1031 } 1035 }
1032 static List<int> parseIPv4Address(String host) { 1036 static List<int> parseIPv4Address(String host) {
1033 void error(String msg) { 1037 void error(String msg) {
1034 throw new FormatException('Illegal IPv4 address, $msg'); 1038 throw new FormatException('Illegal IPv4 address, $msg');
1035 } 1039 }
1036 var bytes = host.split('.'); 1040 var bytes = host.split('.');
1037 if (bytes.length != 4) { 1041 if (bytes.length != 4) {
1038 error('IPv4 address should contain exactly 4 parts'); 1042 error('IPv4 address should contain exactly 4 parts');
1039 } 1043 }
1040 return ((__x26) => DDC$RT.cast(__x26, DDC$RT.type((List<dynamic> _) { 1044 return ((__x31) => DDC$RT.cast(__x31, DDC$RT.type((List<dynamic> _) {
1041 } 1045 }
1042 ), DDC$RT.type((List<int> _) { 1046 ), DDC$RT.type((List<int> _) {
1043 } 1047 }
1044 ), "CastDynamic", """line 1896, column 12 of dart:core/uri.dart: """, __x26 is List<int>, false))(bytes.map((byteString) { 1048 ), "CastDynamic", """line 1896, column 12 of dart:core/uri.dart: """, __x31 is List<int>, false))(bytes.map((byteString) {
1045 int byte = int.parse(DDC$RT.cast(byteString, dynamic, String, "CastGeneral", """line 1898, column 32 of dart:core/uri.dart: """, byteString is String, true) ); 1049 int byte = int.parse(DDC$RT.cast(byteString, dynamic, String, "CastGeneral", """line 1898, column 32 of dart:core/uri.dart: """, byteString is String, true) );
1046 if (byte < 0 || byte > 255) { 1050 if (byte < 0 || byte > 255) {
1047 error('each part must be in the range of `0..255`'); 1051 error('each part must be in the range of `0..255`');
1048 } 1052 }
1049 return byte; 1053 return byte;
1050 } 1054 }
1051 ).toList()); 1055 ).toList());
1052 } 1056 }
1053 static List<int> parseIPv6Address(String host, [int start = 0, int end]) { 1057 static List<int> parseIPv6Address(String host, [int start = 0, int end]) {
1054 if (end == null) end = host.length; 1058 if (end == null) end = host.length;
1055 void error(String msg, [position]) { 1059 void error(String msg, [position]) {
1056 throw new FormatException('Illegal IPv6 address, $msg', host, position); 1060 throw new FormatException('Illegal IPv6 address, $msg', host, DDC$RT.cast(po sition, dynamic, int, "CastGeneral", """line 1933, column 69 of dart:core/uri.da rt: """, position is int, true));
1057 } 1061 }
1058 int parseHex(int start, int end) { 1062 int parseHex(int start, int end) {
1059 if (end - start > 4) { 1063 if (end - start > 4) {
1060 error('an IPv6 part can only contain a maximum of 4 hex digits', start); 1064 error('an IPv6 part can only contain a maximum of 4 hex digits', start);
1061 } 1065 }
1062 int value = int.parse(host.substring(start, end), radix: 16); 1066 int value = int.parse(host.substring(start, end), radix: 16);
1063 if (value < 0 || value > (1 << 16) - 1) { 1067 if (value < 0 || value > (1 << 16) - 1) {
1064 error('each part must be in the range of `0x0..0xFFFF`', start); 1068 error('each part must be in the range of `0x0..0xFFFF`', start);
1065 } 1069 }
1066 return value; 1070 return value;
1067 } 1071 }
1068 if (host.length < 2) error('address is too short'); 1072 if (host.length < 2) error('address is too short');
1069 List<int> parts = ((__x27) => DDC$RT.cast(__x27, DDC$RT.type((List<dynamic> _ ) { 1073 List<int> parts = ((__x32) => DDC$RT.cast(__x32, DDC$RT.type((List<dynamic> _ ) {
1070 } 1074 }
1071 ), DDC$RT.type((List<int> _) { 1075 ), DDC$RT.type((List<int> _) {
1072 } 1076 }
1073 ), "CastLiteral", """line 1946, column 23 of dart:core/uri.dart: """, __x27 is List<int>, false))([]); 1077 ), "CastLiteral", """line 1946, column 23 of dart:core/uri.dart: """, __x32 is List<int>, false))([]);
1074 bool wildcardSeen = false; 1078 bool wildcardSeen = false;
1075 int partStart = start; 1079 int partStart = start;
1076 for (int i = start; i < end; i++) { 1080 for (int i = start; i < end; i++) {
1077 if (host.codeUnitAt(i) == _COLON) { 1081 if (host.codeUnitAt(i) == _COLON) {
1078 if (i == start) { 1082 if (i == start) {
1079 i++; 1083 i++;
1080 if (host.codeUnitAt(i) != _COLON) { 1084 if (host.codeUnitAt(i) != _COLON) {
1081 error('invalid start colon.', i); 1085 error('invalid start colon.', i);
1082 } 1086 }
1083 partStart = i; 1087 partStart = i;
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
1170 static const int _RIGHT_BRACKET = 0x5D; 1174 static const int _RIGHT_BRACKET = 0x5D;
1171 static const int _LOWER_CASE_A = 0x61; 1175 static const int _LOWER_CASE_A = 0x61;
1172 static const int _LOWER_CASE_F = 0x66; 1176 static const int _LOWER_CASE_F = 0x66;
1173 static const int _LOWER_CASE_Z = 0x7A; 1177 static const int _LOWER_CASE_Z = 0x7A;
1174 static const int _BAR = 0x7C; 1178 static const int _BAR = 0x7C;
1175 static String _uriEncode(List<int> canonicalTable, String text, { 1179 static String _uriEncode(List<int> canonicalTable, String text, {
1176 Encoding encoding : UTF8, bool spaceToPlus : false} 1180 Encoding encoding : UTF8, bool spaceToPlus : false}
1177 ) { 1181 ) {
1178 byteToHex(byte, buffer) { 1182 byteToHex(byte, buffer) {
1179 const String hex = '0123456789ABCDEF'; 1183 const String hex = '0123456789ABCDEF';
1180 buffer.writeCharCode(hex.codeUnitAt(((__x28) => DDC$RT.cast(__x28, dynamic, int, "CastGeneral", """line 2059, column 43 of dart:core/uri.dart: """, __x28 i s int, true))(byte >> 4))); 1184 buffer.writeCharCode(hex.codeUnitAt(((__x33) => DDC$RT.cast(__x33, dynamic, int, "CastGeneral", """line 2059, column 43 of dart:core/uri.dart: """, __x33 i s int, true))(byte >> 4)));
1181 buffer.writeCharCode(hex.codeUnitAt(((__x29) => DDC$RT.cast(__x29, dynamic, int, "CastGeneral", """line 2060, column 43 of dart:core/uri.dart: """, __x29 i s int, true))(byte & 0x0f))); 1185 buffer.writeCharCode(hex.codeUnitAt(((__x34) => DDC$RT.cast(__x34, dynamic, int, "CastGeneral", """line 2060, column 43 of dart:core/uri.dart: """, __x34 i s int, true))(byte & 0x0f)));
1182 } 1186 }
1183 StringBuffer result = new StringBuffer(); 1187 StringBuffer result = new StringBuffer();
1184 var bytes = encoding.encode(text); 1188 var bytes = encoding.encode(text);
1185 for (int i = 0; i < bytes.length; i++) { 1189 for (int i = 0; i < bytes.length; i++) {
1186 int byte = bytes[i]; 1190 int byte = bytes[i];
1187 if (byte < 128 && ((canonicalTable[byte >> 4] & (1 << (byte & 0x0f))) != 0) ) { 1191 if (byte < 128 && ((canonicalTable[byte >> 4] & (1 << (byte & 0x0f))) != 0) ) {
1188 result.writeCharCode(byte); 1192 result.writeCharCode(byte);
1189 } 1193 }
1190 else if (spaceToPlus && byte == _SPACE) { 1194 else if (spaceToPlus && byte == _SPACE) {
1191 result.writeCharCode(_PLUS); 1195 result.writeCharCode(_PLUS);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
1227 List<int> bytes; 1231 List<int> bytes;
1228 if (simple) { 1232 if (simple) {
1229 if (encoding == UTF8 || encoding == LATIN1) { 1233 if (encoding == UTF8 || encoding == LATIN1) {
1230 return text; 1234 return text;
1231 } 1235 }
1232 else { 1236 else {
1233 bytes = text.codeUnits; 1237 bytes = text.codeUnits;
1234 } 1238 }
1235 } 1239 }
1236 else { 1240 else {
1237 bytes = ((__x30) => DDC$RT.cast(__x30, DDC$RT.type((List<dynamic> _) { 1241 bytes = ((__x35) => DDC$RT.cast(__x35, DDC$RT.type((List<dynamic> _) {
1238 } 1242 }
1239 ), DDC$RT.type((List<int> _) { 1243 ), DDC$RT.type((List<int> _) {
1240 } 1244 }
1241 ), "CastExact", """line 2134, column 15 of dart:core/uri.dart: """, __x30 is List<int>, false))(new List()); 1245 ), "CastExact", """line 2134, column 15 of dart:core/uri.dart: """, __x35 is List<int>, false))(new List());
1242 for (int i = 0; i < text.length; i++) { 1246 for (int i = 0; i < text.length; i++) {
1243 var codeUnit = text.codeUnitAt(i); 1247 var codeUnit = text.codeUnitAt(i);
1244 if (codeUnit > 127) { 1248 if (codeUnit > 127) {
1245 throw new ArgumentError("Illegal percent encoding in URI"); 1249 throw new ArgumentError("Illegal percent encoding in URI");
1246 } 1250 }
1247 if (codeUnit == _PERCENT) { 1251 if (codeUnit == _PERCENT) {
1248 if (i + 3 > text.length) { 1252 if (i + 3 > text.length) {
1249 throw new ArgumentError('Truncated URI'); 1253 throw new ArgumentError('Truncated URI');
1250 } 1254 }
1251 bytes.add(_hexCharPairToByte(text, i + 1)); 1255 bytes.add(_hexCharPairToByte(text, i + 1));
(...skipping 16 matching lines...) Expand all
1268 static const _schemeTable = const [0x0000, 0x0000, 0x6800, 0x03ff, 0xfffe, 0x07 ff, 0xfffe, 0x07ff]; 1272 static const _schemeTable = const [0x0000, 0x0000, 0x6800, 0x03ff, 0xfffe, 0x07 ff, 0xfffe, 0x07ff];
1269 static const _schemeLowerTable = const [0x0000, 0x0000, 0x6800, 0x03ff, 0x0000, 0x0000, 0xfffe, 0x07ff]; 1273 static const _schemeLowerTable = const [0x0000, 0x0000, 0x6800, 0x03ff, 0x0000, 0x0000, 0xfffe, 0x07ff];
1270 static const _subDelimitersTable = const [0x0000, 0x0000, 0x7fd2, 0x2bff, 0xfff e, 0x87ff, 0xfffe, 0x47ff]; 1274 static const _subDelimitersTable = const [0x0000, 0x0000, 0x7fd2, 0x2bff, 0xfff e, 0x87ff, 0xfffe, 0x47ff];
1271 static const _genDelimitersTable = const [0x0000, 0x0000, 0x8008, 0x8400, 0x000 1, 0x2800, 0x0000, 0x0000]; 1275 static const _genDelimitersTable = const [0x0000, 0x0000, 0x8008, 0x8400, 0x000 1, 0x2800, 0x0000, 0x0000];
1272 static const _userinfoTable = const [0x0000, 0x0000, 0x7fd2, 0x2fff, 0xfffe, 0x 87ff, 0xfffe, 0x47ff]; 1276 static const _userinfoTable = const [0x0000, 0x0000, 0x7fd2, 0x2fff, 0xfffe, 0x 87ff, 0xfffe, 0x47ff];
1273 static const _regNameTable = const [0x0000, 0x0000, 0x7ff2, 0x2bff, 0xfffe, 0x8 7ff, 0xfffe, 0x47ff]; 1277 static const _regNameTable = const [0x0000, 0x0000, 0x7ff2, 0x2bff, 0xfffe, 0x8 7ff, 0xfffe, 0x47ff];
1274 static const _pathCharTable = const [0x0000, 0x0000, 0x7fd2, 0x2fff, 0xffff, 0x 87ff, 0xfffe, 0x47ff]; 1278 static const _pathCharTable = const [0x0000, 0x0000, 0x7fd2, 0x2fff, 0xffff, 0x 87ff, 0xfffe, 0x47ff];
1275 static const _pathCharOrSlashTable = const [0x0000, 0x0000, 0xffd2, 0x2fff, 0xf fff, 0x87ff, 0xfffe, 0x47ff]; 1279 static const _pathCharOrSlashTable = const [0x0000, 0x0000, 0xffd2, 0x2fff, 0xf fff, 0x87ff, 0xfffe, 0x47ff];
1276 static const _queryCharTable = const [0x0000, 0x0000, 0xffd2, 0xafff, 0xffff, 0 x87ff, 0xfffe, 0x47ff]; 1280 static const _queryCharTable = const [0x0000, 0x0000, 0xffd2, 0xafff, 0xffff, 0 x87ff, 0xfffe, 0x47ff];
1277 } 1281 }
OLDNEW
« no previous file with comments | « test/dart_codegen/expect/core/string.dart ('k') | test/dart_codegen/expect/math/point.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698