Skip to content

Commit bd6789d

Browse files
committed
snapshot
1 parent 136e118 commit bd6789d

File tree

5 files changed

+40
-28
lines changed

5 files changed

+40
-28
lines changed

lib/4.06.1/unstable/js_compiler.ml

+6-6
Large diffs are not rendered by default.

lib/4.06.1/unstable/js_refmt_compiler.ml

+6-6
Large diffs are not rendered by default.

lib/4.06.1/whole_compiler.ml

+6-6
Large diffs are not rendered by default.

lib/es6/js_json.js

+11-5
Original file line numberDiff line numberDiff line change
@@ -138,16 +138,22 @@ var patch = (function (json) {
138138

139139
function serializeExn(x) {
140140
return (function(obj){
141-
return JSON.stringify(obj,function(_,value){
141+
var output= JSON.stringify(obj,function(_,value){
142142
if(value===undefined){
143143
return {RE_PRIVATE_NONE : true}
144144
}
145145
return value
146-
})
147-
})(x);
146+
});
147+
148+
if(output === undefined){
149+
// JSON.stringify will raise TypeError when it detects cylic objects
150+
throw new TypeError("output is undefined")
151+
}
152+
return output
153+
})(x);
148154
}
149155

150-
function deserializeExn(s) {
156+
function deserializeUnsafe(s) {
151157
return patch(JSON.parse(s));
152158
}
153159

@@ -160,7 +166,7 @@ export {
160166
decodeArray ,
161167
decodeBoolean ,
162168
decodeNull ,
163-
deserializeExn ,
169+
deserializeUnsafe ,
164170
serializeExn ,
165171

166172
}

lib/js/js_json.js

+11-5
Original file line numberDiff line numberDiff line change
@@ -138,16 +138,22 @@ var patch = (function (json) {
138138

139139
function serializeExn(x) {
140140
return (function(obj){
141-
return JSON.stringify(obj,function(_,value){
141+
var output= JSON.stringify(obj,function(_,value){
142142
if(value===undefined){
143143
return {RE_PRIVATE_NONE : true}
144144
}
145145
return value
146-
})
147-
})(x);
146+
});
147+
148+
if(output === undefined){
149+
// JSON.stringify will raise TypeError when it detects cylic objects
150+
throw new TypeError("output is undefined")
151+
}
152+
return output
153+
})(x);
148154
}
149155

150-
function deserializeExn(s) {
156+
function deserializeUnsafe(s) {
151157
return patch(JSON.parse(s));
152158
}
153159

@@ -159,6 +165,6 @@ exports.decodeObject = decodeObject;
159165
exports.decodeArray = decodeArray;
160166
exports.decodeBoolean = decodeBoolean;
161167
exports.decodeNull = decodeNull;
162-
exports.deserializeExn = deserializeExn;
168+
exports.deserializeUnsafe = deserializeUnsafe;
163169
exports.serializeExn = serializeExn;
164170
/* No side effect */

0 commit comments

Comments
 (0)