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

Side by Side Diff: test/generated_sdk/lib/_internal/compiler/js_lib/js_number.dart

Issue 1121853002: fixes #150, broken code in js_number.dart (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 7 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/_interceptors.js ('k') | tool/input_sdk/private/js_number.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 4
5 part of _interceptors; 5 part of _interceptors;
6 6
7 /** 7 /**
8 * The super interceptor class for [JSInt] and [JSDouble]. The compiler 8 * The super interceptor class for [JSInt] and [JSDouble]. The compiler
9 * recognizes this class as an interceptor, and changes references to 9 * recognizes this class as an interceptor, and changes references to
10 * [:this:] to actually use the receiver of the method, which is 10 * [:this:] to actually use the receiver of the method, which is
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 static String _handleIEtoString(String result) { 159 static String _handleIEtoString(String result) {
160 // Result is probably IE's untraditional format for large numbers, 160 // Result is probably IE's untraditional format for large numbers,
161 // e.g., "8.0000000000008(e+15)" for 0x8000000000000800.toString(16). 161 // e.g., "8.0000000000008(e+15)" for 0x8000000000000800.toString(16).
162 var match = JS('List|Null', 162 var match = JS('List|Null',
163 r'/^([\da-z]+)(?:\.([\da-z]+))?\(e\+(\d+)\)$/.exec(#)', 163 r'/^([\da-z]+)(?:\.([\da-z]+))?\(e\+(\d+)\)$/.exec(#)',
164 result); 164 result);
165 if (match == null) { 165 if (match == null) {
166 // Then we don't know how to handle it at all. 166 // Then we don't know how to handle it at all.
167 throw new UnsupportedError("Unexpected toString result: $result"); 167 throw new UnsupportedError("Unexpected toString result: $result");
168 } 168 }
169 String result = JS('String', '#', match[1]); 169 result = JS('String', '#', match[1]);
170 int exponent = JS("int", "+#", match[3]); 170 int exponent = JS("int", "+#", match[3]);
171 if (match[2] != null) { 171 if (match[2] != null) {
172 result = JS('String', '# + #', result, match[2]); 172 result = JS('String', '# + #', result, match[2]);
173 exponent -= JS('int', '#.length', match[2]); 173 exponent -= JS('int', '#.length', match[2]);
174 } 174 }
175 return result + "0" * exponent; 175 return result + "0" * exponent;
176 } 176 }
177 177
178 // Note: if you change this, also change the function [S]. 178 // Note: if you change this, also change the function [S].
179 String toString() { 179 String toString() {
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 } 413 }
414 414
415 class JSDouble extends JSNumber implements double { 415 class JSDouble extends JSNumber implements double {
416 const JSDouble(); 416 const JSDouble();
417 Type get runtimeType => double; 417 Type get runtimeType => double;
418 } 418 }
419 419
420 class JSPositiveInt extends JSInt {} 420 class JSPositiveInt extends JSInt {}
421 class JSUInt32 extends JSPositiveInt {} 421 class JSUInt32 extends JSPositiveInt {}
422 class JSUInt31 extends JSUInt32 {} 422 class JSUInt31 extends JSUInt32 {}
OLDNEW
« no previous file with comments | « lib/runtime/dart/_interceptors.js ('k') | tool/input_sdk/private/js_number.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698