goto fail;
}
+ parser->lexer = NULL;
+
scope = parser->scope;
ret = njs_variables_scope_reference(vm, scope);
nvm->mem_pool = nmp;
nvm->shared = vm->shared;
+
nvm->trace = vm->trace;
+ nvm->trace.data = nvm;
nvm->variables_hash = vm->variables_hash;
nvm->values_hash = vm->values_hash;
trace = trace->next;
p = trace->handler(trace, td, p);
- if (vm->parser != NULL) {
+ if (vm->parser != NULL && vm->parser->lexer != NULL) {
lexer = vm->parser->lexer;
if (lexer->file.length != 0) {
trace = trace->next;
p = trace->handler(trace, td, start);
- if (vm->parser != NULL) {
+ if (vm->parser != NULL && vm->parser->lexer != NULL) {
njs_syntax_error(vm, "%*s in %uD", p - start, start,
vm->parser->lexer->line);
{ nxt_string("new RegExp('', 'x')"),
nxt_string("SyntaxError: Invalid RegExp flags \"x\"") },
+ { nxt_string("new RegExp('[')"),
+ nxt_string("SyntaxError: pcre_compile(\"[\") failed: missing terminating ] for character class") },
+
{ nxt_string("[0].map(RegExp().toString)"),
nxt_string("TypeError: \"this\" argument is not a regexp") },