diff --git a/lib/output.js b/lib/output.js index b9637929..f4ec36b1 100644 --- a/lib/output.js +++ b/lib/output.js @@ -1153,7 +1153,12 @@ function OutputStream(options) { }; DEFPRINT(AST_RegExp, function(self, output){ - var str = self.getValue().toString(); + var str = self.getValue() + try { + str = str.toString(); + } catch (e) { + throw new Error('Cannot evaluate RegExp [' + self.start.file + ':' + self.start.line + ',' + self.start.col + ']'); + } if (output.option("ascii_only")) { str = output.to_ascii(str); } else if (output.option("unescape_regexps")) {