decrease max clone depth

This commit is contained in:
kzc 2017-11-06 11:17:41 -05:00
parent 1da603d7cb
commit 6c390f5f68

View File

@ -93,8 +93,9 @@ var AST_Token = DEFNODE("Token", "type value line col pos endline endcol endpos
var AST_Node = DEFNODE("Node", "start end", { var AST_Node = DEFNODE("Node", "start end", {
_clone: function(deep, depth) { _clone: function(deep, depth) {
if (typeof depth == "undefined") depth = 0; if (typeof depth == "undefined") depth = 0;
if (depth++ > 1000) { if (depth++ > 500) {
throw new Error("clone depth exceeded (" + this.start.line + ", " + this.start.col + ")"); throw new Error("maximum clone depth exceeded (" +
this.start.file + ":" + this.start.line + ":" + this.start.col + ")");
} }
if (deep) { if (deep) {
var self = this.clone(false, depth); var self = this.clone(false, depth);