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

Side by Side Diff: runtime/lib/uri_patch.dart

Issue 2230383003: Implement @patch annotation for patch class members (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: wip Created 4 years, 4 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 | « runtime/lib/timer_patch.dart ('k') | runtime/lib/vmservice_patch.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 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 import "dart:convert" show ASCII; 5 import "dart:convert" show ASCII;
6 6
7 // VM implementation of Uri. 7 // VM implementation of Uri.
8 typedef Uri _UriBaseClosure(); 8 typedef Uri _UriBaseClosure();
9 9
10 Uri _unsupportedUriBase() { 10 Uri _unsupportedUriBase() {
11 throw new UnsupportedError("'Uri.base' is not supported"); 11 throw new UnsupportedError("'Uri.base' is not supported");
12 } 12 }
13 13
14 // _uriBaseClosure can be overwritten by the embedder to supply a different 14 // _uriBaseClosure can be overwritten by the embedder to supply a different
15 // value for Uri.base. 15 // value for Uri.base.
16 _UriBaseClosure _uriBaseClosure = _unsupportedUriBase; 16 _UriBaseClosure _uriBaseClosure = _unsupportedUriBase;
17 17
18 @patch class Uri { 18 @patch class Uri {
19 static final bool _isWindowsCached = _isWindowsPlatform; 19 static final bool _isWindowsCached = _isWindowsPlatform;
20 20
21 /* @patch */ static bool get _isWindows => _isWindowsCached; 21 @patch static bool get _isWindows => _isWindowsCached;
22 22
23 /* @patch */ static Uri get base => _uriBaseClosure(); 23 @patch static Uri get base => _uriBaseClosure();
24 24
25 static bool get _isWindowsPlatform native "Uri_isWindowsPlatform"; 25 static bool get _isWindowsPlatform native "Uri_isWindowsPlatform";
26 26
27 /* @patch */ static String _uriEncode(List<int> canonicalTable, 27 @patch static String _uriEncode(List<int> canonicalTable,
28 String text, 28 String text,
29 Encoding encoding, 29 Encoding encoding,
30 bool spaceToPlus) { 30 bool spaceToPlus) {
31 // First check if the text will be changed by encoding. 31 // First check if the text will be changed by encoding.
32 int i = 0; 32 int i = 0;
33 if (identical(encoding, UTF8) || 33 if (identical(encoding, UTF8) ||
34 identical(encoding, LATIN1) || 34 identical(encoding, LATIN1) ||
35 identical(encoding, ASCII)) { 35 identical(encoding, ASCII)) {
36 // Encoding is compatible with the original string. 36 // Encoding is compatible with the original string.
37 // Find first character that needs encoding. 37 // Find first character that needs encoding.
(...skipping 26 matching lines...) Expand all
64 } else { 64 } else {
65 const String hexDigits = '0123456789ABCDEF'; 65 const String hexDigits = '0123456789ABCDEF';
66 result..writeCharCode(_PERCENT) 66 result..writeCharCode(_PERCENT)
67 ..writeCharCode(hexDigits.codeUnitAt(byte >> 4)) 67 ..writeCharCode(hexDigits.codeUnitAt(byte >> 4))
68 ..writeCharCode(hexDigits.codeUnitAt(byte & 0x0f)); 68 ..writeCharCode(hexDigits.codeUnitAt(byte & 0x0f));
69 } 69 }
70 } 70 }
71 return result.toString(); 71 return result.toString();
72 } 72 }
73 } 73 }
OLDNEW
« no previous file with comments | « runtime/lib/timer_patch.dart ('k') | runtime/lib/vmservice_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698