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

Side by Side Diff: compiler/lib/implementation/string.js

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
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 function native_StringImplementation__indexOperator(index) { 5 function native_StringImplementation__indexOperator(index) {
6 return this[index]; 6 return this[index];
7 } 7 }
8 8
9 function native_StringImplementation__charCodeAt(index) { 9 function native_StringImplementation__charCodeAt(index) {
10 return this.charCodeAt(index); 10 return this.charCodeAt(index);
11 } 11 }
12 12
13 function native_StringImplementation_get$length() { 13 function native_StringImplementation_get$length() {
14 return this.length; 14 return this.length;
15 } 15 }
16 16
17 function native_StringImplementation_EQ(other) { 17 function native_StringImplementation_EQ(other) {
18 if (typeof other == 'string') { 18 return typeof other == 'string' && this == other;
19 return this == other;
20 } else if (other instanceof String) {
21 // Must convert other to a primitive for value equality to work.
22 return this == String(other);
23 } else {
24 return false;
25 }
26 } 19 }
27 20
28 function native_StringImplementation_indexOf(other, startIndex) { 21 function native_StringImplementation_indexOf(other, startIndex) {
29 return this.indexOf(other, startIndex); 22 return this.indexOf(other, startIndex);
30 } 23 }
31 24
32 function native_StringImplementation_lastIndexOf(other, fromIndex) { 25 function native_StringImplementation_lastIndexOf(other, fromIndex) {
33 if (other == "") { 26 if (other == "") {
34 return Math.min(this.length, fromIndex); 27 return Math.min(this.length, fromIndex);
35 } 28 }
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 } 117 }
125 array = tmp; 118 array = tmp;
126 } 119 }
127 return String.fromCharCode.apply(this, array); 120 return String.fromCharCode.apply(this, array);
128 } 121 }
129 122
130 // Deprecated old name of new String.fromValues(..). 123 // Deprecated old name of new String.fromValues(..).
131 function native_StringBase_createFromCharCodes(array) { 124 function native_StringBase_createFromCharCodes(array) {
132 return native_StringImplementation__newFromValues(array); 125 return native_StringImplementation__newFromValues(array);
133 } 126 }
OLDNEW
« compiler/lib/implementation/string.dart ('K') | « compiler/lib/implementation/string.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698