OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 part of dart.core; | 5 part of dart.core; |
6 | 6 |
7 // Frequently used character codes. | 7 // Frequently used character codes. |
8 const int _SPACE = 0x20; | 8 const int _SPACE = 0x20; |
9 const int _PERCENT = 0x25; | 9 const int _PERCENT = 0x25; |
10 const int _AMPERSAND = 0x26; | 10 const int _AMPERSAND = 0x26; |
(...skipping 4356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4367 } | 4367 } |
4368 | 4368 |
4369 Uri resolveUri(Uri reference) { | 4369 Uri resolveUri(Uri reference) { |
4370 if (reference is _SimpleUri) { | 4370 if (reference is _SimpleUri) { |
4371 return _simpleMerge(this, reference); | 4371 return _simpleMerge(this, reference); |
4372 } | 4372 } |
4373 return _toNonSimple().resolveUri(reference); | 4373 return _toNonSimple().resolveUri(reference); |
4374 } | 4374 } |
4375 | 4375 |
4376 // Merge two simple URIs. This should always result in a prefix of | 4376 // Merge two simple URIs. This should always result in a prefix of |
4377 // one concatentated with a suffix of the other, possibly with a `/` in | 4377 // one concatenated with a suffix of the other, possibly with a `/` in |
4378 // the middle of two merged paths, which is again simple. | 4378 // the middle of two merged paths, which is again simple. |
4379 // In a few cases, there might be a need for extra normalization, when | 4379 // In a few cases, there might be a need for extra normalization, when |
4380 // resolving on top of a known scheme. | 4380 // resolving on top of a known scheme. |
4381 Uri _simpleMerge(_SimpleUri base, _SimpleUri ref) { | 4381 Uri _simpleMerge(_SimpleUri base, _SimpleUri ref) { |
4382 if (ref.hasScheme) return ref; | 4382 if (ref.hasScheme) return ref; |
4383 if (ref.hasAuthority) { | 4383 if (ref.hasAuthority) { |
4384 if (!base.hasScheme) return ref; | 4384 if (!base.hasScheme) return ref; |
4385 bool isSimple = true; | 4385 bool isSimple = true; |
4386 if (base._isFile) { | 4386 if (base._isFile) { |
4387 isSimple = !ref.hasEmptyPath; | 4387 isSimple = !ref.hasEmptyPath; |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4630 int delta = (text.codeUnitAt(start + 4) ^ _COLON) * 3; | 4630 int delta = (text.codeUnitAt(start + 4) ^ _COLON) * 3; |
4631 delta |= text.codeUnitAt(start) ^ 0x64 /*d*/; | 4631 delta |= text.codeUnitAt(start) ^ 0x64 /*d*/; |
4632 delta |= text.codeUnitAt(start + 1) ^ 0x61 /*a*/; | 4632 delta |= text.codeUnitAt(start + 1) ^ 0x61 /*a*/; |
4633 delta |= text.codeUnitAt(start + 2) ^ 0x74 /*t*/; | 4633 delta |= text.codeUnitAt(start + 2) ^ 0x74 /*t*/; |
4634 delta |= text.codeUnitAt(start + 3) ^ 0x61 /*a*/; | 4634 delta |= text.codeUnitAt(start + 3) ^ 0x61 /*a*/; |
4635 return delta; | 4635 return delta; |
4636 } | 4636 } |
4637 | 4637 |
4638 /// Helper function returning the length of a string, or `0` for `null`. | 4638 /// Helper function returning the length of a string, or `0` for `null`. |
4639 int _stringOrNullLength(String s) => (s == null) ? 0 : s.length; | 4639 int _stringOrNullLength(String s) => (s == null) ? 0 : s.length; |
OLD | NEW |