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

Unified Diff: compiler/lib/implementation/string.js

Issue 8241013: Pull "$instanceOf" methods off of the native object. No change in behavior. (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « compiler/lib/implementation/rtt.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: compiler/lib/implementation/string.js
===================================================================
--- compiler/lib/implementation/string.js (revision 368)
+++ compiler/lib/implementation/string.js (working copy)
@@ -2,14 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-/**
- * Extend the String prototype with members expected in dart.
- */
-
-String.$instanceOf = function(obj) {
- return typeof obj == 'string' || obj instanceof String;
-};
-
function native_StringImplementation__indexOperator(index) {
return this[index];
}
@@ -58,7 +50,7 @@
}
function native_StringImplementation__replace(from, to) {
- if (String.$instanceOf(from)) {
+ if ($isString(from)) {
return this.replace(from, to);
} else {
return this.replace($DartRegExpToJSRegExp(from), to);
@@ -66,7 +58,7 @@
}
function native_StringImplementation__replaceAll(from, to) {
- if (String.$instanceOf(from)) {
+ if ($isString(from)) {
var regexp = new RegExp(
from.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), 'g');
return this.replace(regexp, to);
@@ -77,7 +69,7 @@
}
function native_StringImplementation__split(pattern) {
- if (String.$instanceOf(pattern)) {
+ if ($isString(pattern)) {
return this.split(pattern);
} else {
return this.split($DartRegExpToJSRegExp(pattern));
« no previous file with comments | « compiler/lib/implementation/rtt.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698