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

Unified Diff: src/string.js

Issue 93066: Built-in JSON support (Closed)
Patch Set: Created 11 years, 8 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
« src/objects.h ('K') | « src/property.h ('k') | src/v8natives.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/string.js
diff --git a/src/string.js b/src/string.js
index 3ccad9a21a9d445217d639b602191f6e0a3f7c65..c7a838e9ffba2532bce7e9f9f85ccedfb36241ec 100644
--- a/src/string.js
+++ b/src/string.js
@@ -812,6 +812,11 @@ ReplaceResultBuilder.prototype.generate = function() {
}
+function StringToJSON(key) {
+ return CheckJSONPrimitive(this.valueOf());
+}
+
+
// -------------------------------------------------------------------
function SetupString() {
@@ -858,7 +863,8 @@ function SetupString() {
"small", StringSmall,
"strike", StringStrike,
"sub", StringSub,
- "sup", StringSup
+ "sup", StringSup,
+ "toJSON", StringToJSON
));
}
« src/objects.h ('K') | « src/property.h ('k') | src/v8natives.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698