[parser] Cook invalid template literals if we've thrown
Otherwise we may look into the invalid string literal later. Bug: chromium:903527 Change-Id: Ieeb3807bd05e532224e04a59878f5dac24e19579 Reviewed-on: https://chromium-review.googlesource.com/c/1329691 Commit-Queue: Toon Verwaest <verwaest@chromium.org> Reviewed-by: Igor Sheludko <ishell@chromium.org> Cr-Commit-Position: refs/heads/master@{#57423}
This commit is contained in:
parent
c357d22cfd
commit
65ab5bb669
@ -3084,6 +3084,7 @@ class AstNodeFactory final {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Literal* NewStringLiteral(const AstRawString* string, int pos) {
|
Literal* NewStringLiteral(const AstRawString* string, int pos) {
|
||||||
|
DCHECK_NOT_NULL(string);
|
||||||
return new (zone_) Literal(string, pos);
|
return new (zone_) Literal(string, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -782,7 +782,7 @@ class ParserBase {
|
|||||||
impl()->ReportMessageAt(scanner()->invalid_template_escape_location(),
|
impl()->ReportMessageAt(scanner()->invalid_template_escape_location(),
|
||||||
scanner()->invalid_template_escape_message());
|
scanner()->invalid_template_escape_message());
|
||||||
}
|
}
|
||||||
return false;
|
return should_throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CheckDestructuringElement(ExpressionT element, int beg_pos, int end_pos);
|
void CheckDestructuringElement(ExpressionT element, int beg_pos, int end_pos);
|
||||||
|
5
test/mjsunit/regress/regress-903527.js
Normal file
5
test/mjsunit/regress/regress-903527.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
// Copyright 2018 the V8 project authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
|
// found in the LICENSE file.
|
||||||
|
|
||||||
|
assertThrows("e*!`\\2`", SyntaxError)
|
Loading…
Reference in New Issue
Block a user