Allow parsing regexp after arrow token (#1439)
This commit is contained in:
committed by
Richard van Velzen
parent
52ce9a333c
commit
4728bc73ad
@@ -335,7 +335,8 @@ function tokenizer($TEXT, filename, html5_comments, shebang) {
|
|||||||
function token(type, value, is_comment) {
|
function token(type, value, is_comment) {
|
||||||
S.regex_allowed = ((type == "operator" && !UNARY_POSTFIX(value)) ||
|
S.regex_allowed = ((type == "operator" && !UNARY_POSTFIX(value)) ||
|
||||||
(type == "keyword" && KEYWORDS_BEFORE_EXPRESSION(value)) ||
|
(type == "keyword" && KEYWORDS_BEFORE_EXPRESSION(value)) ||
|
||||||
(type == "punc" && PUNC_BEFORE_EXPRESSION(value)));
|
(type == "punc" && PUNC_BEFORE_EXPRESSION(value))) ||
|
||||||
|
(type == "arrow");
|
||||||
prev_was_dot = (type == "punc" && value == ".");
|
prev_was_dot = (type == "punc" && value == ".");
|
||||||
var ret = {
|
var ret = {
|
||||||
type : type,
|
type : type,
|
||||||
|
|||||||
@@ -126,3 +126,12 @@ arrow_binding_pattern_strict: {
|
|||||||
}
|
}
|
||||||
expect_exact: 'var foo=([,])=>"foo";'
|
expect_exact: 'var foo=([,])=>"foo";'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
arrow_with_regexp: {
|
||||||
|
input: {
|
||||||
|
num => /\d{11,14}/.test( num )
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
num => /\d{11,14}/.test( num )
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user