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

Side by Side Diff: compiler/lib/implementation/bool.dart

Issue 8286001: Changes "is" and equality checks to strictly check for primitive types, fix a couple of (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 9 years, 2 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 | compiler/lib/implementation/bool.js » ('j') | compiler/lib/implementation/bool.js » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 // Adds Dart-methods to the prototype of the JS Boolean function. 5 // Adds Dart-methods to the prototype of the JS Boolean function.
6 // TODO(floitsch): the following comment needs to be updated once we compile 6 // TODO(floitsch): the following comment needs to be updated once we compile
7 // boolean checks with '=== true'. 7 // boolean checks with '=== true'.
8 // WARNING: 'this' inside this class is always treated as 'true'. 8 // WARNING: 'this' inside this class is always treated as 'true'.
9 // That is if (this) ... will always pick the 'then' branch. 9 // That is if (this) ... will always pick the 'then' branch.
10 // The reason is that, once compiled to JS, 'this' is represented by a 10 // The reason is that, once compiled to JS, 'this' is represented by a
11 // JS Boolean object. However "if (new Boolean(false)) .." picks the then 11 // JS Boolean object. However "if (new Boolean(false)) .." picks the then
12 // branch. 12 // branch.
13 class BoolImplementation implements bool native "Boolean" { 13 class BoolImplementation implements bool native "Boolean" {
14 bool operator ==(other) native; 14 bool operator ==(other) native;
15 15
16 // TODO(floitsch): we should intercept toString for primitives, to avoid 16 // TODO(floitsch): we should intercept toString for primitives, to avoid
17 // creating a wrapper object. 17 // creating a wrapper object.
18 String toString() native; 18 String toString() native;
19
20 BoolImplementation toBool() native;
21
22 get dynamic() { return toBool(); }
floitsch 2011/10/14 20:20:44 good catch.
19 } 23 }
OLDNEW
« no previous file with comments | « no previous file | compiler/lib/implementation/bool.js » ('j') | compiler/lib/implementation/bool.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698