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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after
805 StringBuilder.prototype.generate = function() { 805 StringBuilder.prototype.generate = function() {
806 return %StringBuilderConcat(this.elements, ""); 806 return %StringBuilderConcat(this.elements, "");
807 } 807 }
808 808
809 809
810 ReplaceResultBuilder.prototype.generate = function() { 810 ReplaceResultBuilder.prototype.generate = function() {
811 return %StringBuilderConcat(this.elements, this.special_string); 811 return %StringBuilderConcat(this.elements, this.special_string);
812 } 812 }
813 813
814 814
815 function StringToJSON(key) {
816 return CheckJSONPrimitive(this.valueOf());
817 }
818
819
815 // ------------------------------------------------------------------- 820 // -------------------------------------------------------------------
816 821
817 function SetupString() { 822 function SetupString() {
818 // Setup the constructor property on the String prototype object. 823 // Setup the constructor property on the String prototype object.
819 %SetProperty($String.prototype, "constructor", $String, DONT_ENUM); 824 %SetProperty($String.prototype, "constructor", $String, DONT_ENUM);
820 825
821 826
822 // Setup the non-enumerable functions on the String object. 827 // Setup the non-enumerable functions on the String object.
823 InstallFunctions($String, DONT_ENUM, $Array( 828 InstallFunctions($String, DONT_ENUM, $Array(
824 "fromCharCode", StringFromCharCode 829 "fromCharCode", StringFromCharCode
(...skipping 26 matching lines...) Expand all
851 "fontcolor", StringFontcolor, 856 "fontcolor", StringFontcolor,
852 "fontsize", StringFontsize, 857 "fontsize", StringFontsize,
853 "big", StringBig, 858 "big", StringBig,
854 "blink", StringBlink, 859 "blink", StringBlink,
855 "bold", StringBold, 860 "bold", StringBold,
856 "fixed", StringFixed, 861 "fixed", StringFixed,
857 "italics", StringItalics, 862 "italics", StringItalics,
858 "small", StringSmall, 863 "small", StringSmall,
859 "strike", StringStrike, 864 "strike", StringStrike,
860 "sub", StringSub, 865 "sub", StringSub,
861 "sup", StringSup 866 "sup", StringSup,
867 "toJSON", StringToJSON
862 )); 868 ));
863 } 869 }
864 870
865 871
866 SetupString(); 872 SetupString();
OLDNEW
« 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