Chromium Code Reviews| Index: lib/compiler/implementation/lib/interceptors.dart |
| diff --git a/lib/compiler/implementation/lib/interceptors.dart b/lib/compiler/implementation/lib/interceptors.dart |
| index e94d94c0561541e48c3118fb9b1fa18077684f09..259a73404788dbcd399295d15eb904301526fcc0 100644 |
| --- a/lib/compiler/implementation/lib/interceptors.dart |
| +++ b/lib/compiler/implementation/lib/interceptors.dart |
| @@ -55,7 +55,7 @@ set$length(receiver, newLength) { |
| } |
| toString(var value) { |
| - if (JS('bool', @'typeof # == "object"', value)) { |
| + if (JS('bool', @'typeof # == "object" && # !== null', value, value)) { |
| if (isJsArray(value)) { |
| return Collections.collectionToString(value); |
| } else { |
| @@ -449,10 +449,13 @@ toStringAsExponential(receiver, fractionDigits) { |
| if (receiver is !num) { |
| return UNINTERCEPTED(receiver.toStringAsExponential(fractionDigits)); |
| } |
| - if (fractionDigits !== null) checkNum(fractionDigits); |
| - |
| - String result = JS('String', @'#.toExponential(#)', |
| - receiver, fractionDigits); |
| + String result; |
| + if (fractionDigits !== null) { |
|
sra1
2012/06/21 19:42:50
!=
sra1
2012/06/21 22:33:23
Sorry, this is Dart code :-)
When the new changes
|
| + checkNum(fractionDigits); |
| + result = JS('String', @'#.toExponential(#)', receiver, fractionDigits); |
| + } else { |
| + result = JS('String', @'#.toExponential()', receiver); |
| + } |
| if (receiver == 0 && receiver.isNegative()) return "-$result"; |
| return result; |
| } |