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

Unified Diff: lib/compiler/implementation/compile_time_constants.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
Index: lib/compiler/implementation/compile_time_constants.dart
diff --git a/lib/compiler/implementation/compile_time_constants.dart b/lib/compiler/implementation/compile_time_constants.dart
index ae7fe1d2eaa8afa7caaa26c67114e44e162bb038..86cfe4fed3cfdd40a29652c1cf2a5e3ad830248c 100644
--- a/lib/compiler/implementation/compile_time_constants.dart
+++ b/lib/compiler/implementation/compile_time_constants.dart
@@ -56,13 +56,16 @@ class PrimitiveConstant extends Constant {
}
class NullConstant extends PrimitiveConstant {
+ /** The value a Dart null is compiled to in JavaScript. */
+ static final String JsNull = "null";
+
factory NullConstant() => const NullConstant._internal();
const NullConstant._internal();
bool isNull() => true;
get value() => null;
void _writeJsCode(StringBuffer buffer, ConstantHandler handler) {
- buffer.add("(void 0)");
+ buffer.add(JsNull);
}
// The magic constant has no meaning. It is just a random value.
« no previous file with comments | « no previous file | lib/compiler/implementation/emitter.dart » ('j') | lib/compiler/implementation/lib/interceptors.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698