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

Issue 8286001: Changes "is" and equality checks to strictly check for primitive types, fix a couple of (Closed)

Created:
9 years, 2 months ago by John Lenz
Modified:
9 years, 2 months ago
Reviewers:
floitsch
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Changes "is" and equality checks to strictly check for primitive types, fix a couple of places we were converting primitives to Object types by "this" coersions. Fixes issue 79. Committed: https://code.google.com/p/dart/source/detail?r=456

Patch Set 1 #

Total comments: 9
Unified diffs Side-by-side diffs Delta from patch set Stats (+25 lines, -33 lines) Patch
M compiler/lib/implementation/bool.dart View 1 chunk +4 lines, -0 lines 1 comment Download
M compiler/lib/implementation/bool.js View 1 chunk +6 lines, -11 lines 4 comments Download
M compiler/lib/implementation/number.dart View 2 chunks +2 lines, -2 lines 0 comments Download
M compiler/lib/implementation/number.js View 2 chunks +5 lines, -8 lines 2 comments Download
M compiler/lib/implementation/rtt.js View 3 chunks +3 lines, -3 lines 0 comments Download
M compiler/lib/implementation/string.dart View 2 chunks +4 lines, -1 line 2 comments Download
M compiler/lib/implementation/string.js View 1 chunk +1 line, -8 lines 0 comments Download

Messages

Total messages: 4 (0 generated)
John Lenz
9 years, 2 months ago (2011-10-13 17:38:22 UTC) #1
John Lenz
On 2011/10/13 17:38:22, John Lenz wrote: Florian, would you prefer someone else look at the ...
9 years, 2 months ago (2011-10-14 15:54:58 UTC) #2
floitsch
LGTM! sorry for the delay. http://codereview.chromium.org/8286001/diff/1/compiler/lib/implementation/bool.dart File compiler/lib/implementation/bool.dart (right): http://codereview.chromium.org/8286001/diff/1/compiler/lib/implementation/bool.dart#newcode22 compiler/lib/implementation/bool.dart:22: get dynamic() { return ...
9 years, 2 months ago (2011-10-14 20:20:44 UTC) #3
John Lenz
9 years, 2 months ago (2011-10-14 21:26:40 UTC) #4
http://codereview.chromium.org/8286001/diff/1/compiler/lib/implementation/boo...
File compiler/lib/implementation/bool.js (right):

http://codereview.chromium.org/8286001/diff/1/compiler/lib/implementation/boo...
compiler/lib/implementation/bool.js:5: function
native_BoolImplementation_EQ(other) {
On 2011/10/14 20:20:44, floitsch wrote:
> maybe for another CL, but ideally we should never end up here.
> operator$EQ should simply say:
> if (typeof x == "boolean") return x === other;

yes. I leave that for another CL. After we have golem back up and running.

http://codereview.chromium.org/8286001/diff/1/compiler/lib/implementation/boo...
compiler/lib/implementation/bool.js:9: function
native_BoolImplementation_toString() {
On 2011/10/14 20:20:44, floitsch wrote:
> Same is true here. Since we already need to intercept 'toString', to support
> null.toString, we should intercept booleans there too.

true, there is less need for this to be special cased, I think.

http://codereview.chromium.org/8286001/diff/1/compiler/lib/implementation/num...
File compiler/lib/implementation/number.js (right):

http://codereview.chromium.org/8286001/diff/1/compiler/lib/implementation/num...
compiler/lib/implementation/number.js:87: return typeof other == 'number' &&
this == other;
On 2011/10/14 20:20:44, floitsch wrote:
> Same as for booleans: operator$EQ should intercept and we should never arrive
> here.
> (again: another CL is fine).

It is already special cased in EQ$operator, but I'll leave this for now.

http://codereview.chromium.org/8286001/diff/1/compiler/lib/implementation/str...
File compiler/lib/implementation/string.dart (right):

http://codereview.chromium.org/8286001/diff/1/compiler/lib/implementation/str...
compiler/lib/implementation/string.dart:148: // call "toString" to coerse the
"this" back to a primitive string
On 2011/10/14 20:20:44, floitsch wrote:
> Call ... coerce ... string. (finish with dot).

Done.

Powered by Google App Engine
This is Rietveld 408576698