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

Unified Diff: lib/compiler/implementation/lib/interceptors.dart

Issue 10533151: Make undefined and null equivalent. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: rebase Created 8 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/compiler/implementation/emitter.dart ('k') | lib/compiler/implementation/lib/js_helper.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « lib/compiler/implementation/emitter.dart ('k') | lib/compiler/implementation/lib/js_helper.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698