vendor/v8/src/json.js in mustang-0.0.1 vs vendor/v8/src/json.js in mustang-0.1.0
- old
+ new
@@ -47,11 +47,11 @@
}
}
}
}
}
- return reviver.call(holder, name, val);
+ return %_CallFunction(holder, name, val, reviver);
}
function JSONParse(text, reviver) {
var unfiltered = %ParseJson(TO_STRING_INLINE(text));
if (IS_FUNCTION(reviver)) {
@@ -61,15 +61,15 @@
}
}
function SerializeArray(value, replacer, stack, indent, gap) {
if (!%PushIfAbsent(stack, value)) {
- throw MakeTypeError('circular_structure', []);
+ throw MakeTypeError('circular_structure', $Array());
}
var stepback = indent;
indent += gap;
- var partial = [];
+ var partial = new InternalArray();
var len = value.length;
for (var i = 0; i < len; i++) {
var strP = JSONSerialize($String(i), value, replacer, stack,
indent, gap);
if (IS_UNDEFINED(strP)) {
@@ -91,15 +91,15 @@
return final;
}
function SerializeObject(value, replacer, stack, indent, gap) {
if (!%PushIfAbsent(stack, value)) {
- throw MakeTypeError('circular_structure', []);
+ throw MakeTypeError('circular_structure', $Array());
}
var stepback = indent;
indent += gap;
- var partial = [];
+ var partial = new InternalArray();
if (IS_ARRAY(replacer)) {
var length = replacer.length;
for (var i = 0; i < length; i++) {
if (%_CallFunction(replacer, i, ObjectHasOwnProperty)) {
var p = replacer[i];
@@ -183,11 +183,11 @@
if (len == 0) {
builder.push("[]");
return;
}
if (!%PushIfAbsent(stack, value)) {
- throw MakeTypeError('circular_structure', []);
+ throw MakeTypeError('circular_structure', $Array());
}
builder.push("[");
var val = value[0];
if (IS_STRING(val)) {
// First entry is a string. Remaining entries are likely to be strings too.
@@ -236,11 +236,11 @@
}
function BasicSerializeObject(value, stack, builder) {
if (!%PushIfAbsent(stack, value)) {
- throw MakeTypeError('circular_structure', []);
+ throw MakeTypeError('circular_structure', $Array());
}
builder.push("{");
var first = true;
for (var p in value) {
if (%HasLocalProperty(value, p)) {
@@ -299,12 +299,12 @@
}
function JSONStringify(value, replacer, space) {
if (%_ArgumentsLength() == 1) {
- var builder = [];
- BasicJSONSerialize('', value, [], builder);
+ var builder = new InternalArray();
+ BasicJSONSerialize('', value, new InternalArray(), builder);
if (builder.length == 0) return;
var result = %_FastAsciiArrayJoin(builder, "");
if (!IS_UNDEFINED(result)) return result;
return %StringBuilderConcat(builder, builder.length, "");
}
@@ -327,10 +327,10 @@
gap = space;
}
} else {
gap = "";
}
- return JSONSerialize('', {'': value}, replacer, [], "", gap);
+ return JSONSerialize('', {'': value}, replacer, new InternalArray(), "", gap);
}
function SetupJSON() {
InstallFunctions($JSON, DONT_ENUM, $Array(
"parse", JSONParse,