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

Side by Side Diff: runtime/lib/double_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/deferred_load_patch.dart ('k') | runtime/lib/errors_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) 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 // Dart core library. 4 // Dart core library.
5 5
6 // VM implementation of double. 6 // VM implementation of double.
7 7
8 @patch class double { 8 @patch class double {
9 9
10 static double _nativeParse(String str, 10 static double _nativeParse(String str,
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 int len = str.length; 94 int len = str.length;
95 int start = str._firstNonWhitespace(); 95 int start = str._firstNonWhitespace();
96 if (start == len) return null; // All whitespace. 96 if (start == len) return null; // All whitespace.
97 int end = str._lastNonWhitespace() + 1; 97 int end = str._lastNonWhitespace() + 1;
98 assert(start < end); 98 assert(start < end);
99 var result = _tryParseDouble(str, start, end); 99 var result = _tryParseDouble(str, start, end);
100 if (result != null) return result; 100 if (result != null) return result;
101 return _nativeParse(str, start, end); 101 return _nativeParse(str, start, end);
102 } 102 }
103 103
104 /* @patch */ static double parse(String str, 104 @patch static double parse(String str,
105 [double onError(String str)]) { 105 [double onError(String str)]) {
106 var result = _parse(str); 106 var result = _parse(str);
107 if (result == null) { 107 if (result == null) {
108 if (onError == null) throw new FormatException("Invalid double", str); 108 if (onError == null) throw new FormatException("Invalid double", str);
109 return onError(str); 109 return onError(str);
110 } 110 }
111 return result; 111 return result;
112 } 112 }
113 } 113 }
OLDNEW
« no previous file with comments | « runtime/lib/deferred_load_patch.dart ('k') | runtime/lib/errors_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698