Created
April 4, 2012 18:55
-
-
Save BenjaminPoulain/2304736 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Replace: "value.toString(exec)->value(exec)" by value.toUString(exec): | |
diff --git a/Source/JavaScriptCore/runtime/JSString.h b/Source/JavaScriptCore/runtime/JSString.h | |
index 32a3278..1477962 100644 | |
--- a/Source/JavaScriptCore/runtime/JSString.h | |
+++ b/Source/JavaScriptCore/runtime/JSString.h | |
@@ -462,6 +462,20 @@ namespace JSC { | |
return toStringSlowCase(exec); | |
} | |
+ inline UString JSValue::toUString(ExecState* exec) const | |
+ { | |
+ JSGlobalData& globalData = exec->globalData(); | |
+ if (isInt32()) | |
+ return globalData.numericStrings.add(asInt32()); | |
+ if (isDouble()) | |
+ return globalData.numericStrings.add(asDouble()); | |
+ if (isTrue()) | |
+ return globalData.propertyNames->trueKeyword.ustring(); | |
+ if (isFalse()) | |
+ return globalData.propertyNames->falseKeyword.ustring(); | |
+ return toString(exec)->value(exec); | |
+ } | |
+ | |
} // namespace JSC | |
#endif // JSString_h | |
diff --git a/Source/JavaScriptCore/runtime/JSValue.h b/Source/JavaScriptCore/runtime/JSValue.h | |
index ba0ae23..741e4f5 100644 | |
--- a/Source/JavaScriptCore/runtime/JSValue.h | |
+++ b/Source/JavaScriptCore/runtime/JSValue.h | |
@@ -203,6 +203,7 @@ namespace JSC { | |
// been set in the ExecState already. | |
double toNumber(ExecState*) const; | |
JSString* toString(ExecState*) const; | |
+ UString toUString(ExecState*) const; | |
JSObject* toObject(ExecState*) const; | |
JSObject* toObject(ExecState*, JSGlobalObject*) const; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment