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

Side by Side Diff: frog/leg/lib/js_helper.dart

Issue 9695006: Return -0.. when the input to toStringAs* is -0.0. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | tests/language/language-leg.status » ('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 #library('js_helper'); 5 #library('js_helper');
6 6
7 #import('coreimpl.dart'); 7 #import('coreimpl.dart');
8 8
9 #source('constant_map.dart'); 9 #source('constant_map.dart');
10 #source('date_helper.dart'); 10 #source('date_helper.dart');
(...skipping 940 matching lines...) Expand 10 before | Expand all | Expand 10 after
951 return receiver < 0 ? receiver.ceil() : receiver.floor(); 951 return receiver < 0 ? receiver.ceil() : receiver.floor();
952 } 952 }
953 953
954 builtin$toStringAsFixed$1(receiver, fractionDigits) { 954 builtin$toStringAsFixed$1(receiver, fractionDigits) {
955 checkNull(receiver); 955 checkNull(receiver);
956 if (receiver is !num) { 956 if (receiver is !num) {
957 return UNINTERCEPTED(receiver.toStringAsFixed(fractionDigits)); 957 return UNINTERCEPTED(receiver.toStringAsFixed(fractionDigits));
958 } 958 }
959 checkNum(fractionDigits); 959 checkNum(fractionDigits);
960 960
961 return JS('String', @'$0.toFixed($1)', receiver, fractionDigits); 961 String result = JS('String', @'$0.toFixed($1)', receiver, fractionDigits);
962 if (receiver == 0 && receiver.isNegative()) return "-$result";
963 return result;
962 } 964 }
963 965
964 builtin$toStringAsExponential$1(receiver, fractionDigits) { 966 builtin$toStringAsExponential$1(receiver, fractionDigits) {
965 checkNull(receiver); 967 checkNull(receiver);
966 if (receiver is !num) { 968 if (receiver is !num) {
967 return UNINTERCEPTED(receiver.toStringAsExponential(fractionDigits)); 969 return UNINTERCEPTED(receiver.toStringAsExponential(fractionDigits));
968 } 970 }
969 checkNum(fractionDigits); 971 checkNum(fractionDigits);
970 972
971 return JS('String', @'$0.toExponential($1)', receiver, fractionDigits); 973 String result = JS('String', @'$0.toExponential($1)',
974 receiver, fractionDigits);
975 if (receiver == 0 && receiver.isNegative()) return "-$result";
976 return result;
972 } 977 }
973 978
974 builtin$toStringAsPrecision$1(receiver, fractionDigits) { 979 builtin$toStringAsPrecision$1(receiver, fractionDigits) {
975 checkNull(receiver); 980 checkNull(receiver);
976 if (receiver is !num) { 981 if (receiver is !num) {
977 return UNINTERCEPTED(receiver.toStringAsPrecision(fractionDigits)); 982 return UNINTERCEPTED(receiver.toStringAsPrecision(fractionDigits));
978 } 983 }
979 checkNum(fractionDigits); 984 checkNum(fractionDigits);
980 985
981 return JS('String', @'$0.toPrecision($1)', receiver, fractionDigits); 986 String result = JS('String', @'$0.toPrecision($1)',
987 receiver, fractionDigits);
988 if (receiver == 0 && receiver.isNegative()) return "-$result";
989 return result;
982 } 990 }
983 991
984 builtin$toRadixString$1(receiver, radix) { 992 builtin$toRadixString$1(receiver, radix) {
985 checkNull(receiver); 993 checkNull(receiver);
986 if (receiver is !num) { 994 if (receiver is !num) {
987 return UNINTERCEPTED(receiver.toRadixString(radix)); 995 return UNINTERCEPTED(receiver.toRadixString(radix));
988 } 996 }
989 checkNum(radix); 997 checkNum(radix);
990 998
991 return JS('String', @'$0.toString($1)', receiver, radix); 999 return JS('String', @'$0.toString($1)', receiver, radix);
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
1378 String toString() => "Closure"; 1386 String toString() => "Closure";
1379 } 1387 }
1380 1388
1381 bool jsHasOwnProperty(var jsObject, String property) { 1389 bool jsHasOwnProperty(var jsObject, String property) {
1382 return JS('bool', @'$0.hasOwnProperty($1)', jsObject, property); 1390 return JS('bool', @'$0.hasOwnProperty($1)', jsObject, property);
1383 } 1391 }
1384 1392
1385 jsPropertyAccess(var jsObject, String property) { 1393 jsPropertyAccess(var jsObject, String property) {
1386 return JS('var', @'$0[$1]', jsObject, property); 1394 return JS('var', @'$0[$1]', jsObject, property);
1387 } 1395 }
OLDNEW
« no previous file with comments | « no previous file | tests/language/language-leg.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698