Throw descriptive error for Invalid RegExp
Throws up descriptive error when parsing an invalid regular expression "test".match(/test/i || /test2/i);
This commit is contained in:
parent
e3342a3cf6
commit
11aad46078
|
|
@ -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")) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user