// case, representing a TemplateMiddle).
do {
+ CheckTemplateOctalLiteral(pos, peek_position(), CHECK_OK);
next = peek();
if (!next) {
ReportMessageAt(Scanner::Location(start, peek_position()),
// TEMPLATE_SPAN or TEMPLATE_TAIL.
next = scanner()->ScanTemplateContinuation();
Next();
+ pos = position();
if (!next) {
- ReportMessageAt(Scanner::Location(start, position()),
- "unterminated_template");
+ ReportMessageAt(Scanner::Location(start, pos), "unterminated_template");
*ok = false;
return Traits::EmptyExpression();
}
assertEquals("\u00008", `\08`);
assertEquals("\u00009", `\09`);
})();
+
+
+(function testLegacyOctalEscapesInExpressions() {
+ // Allowed in sloppy expression
+ assertEquals("\x07", `${"\07"}`);
+
+ // Disallowed in template tail
+ assertThrows("`${\"\\07\"}\\07`", SyntaxError);
+
+ // Disallowed in strict expression
+ assertThrows("`${(function() { \"use strict\"; return \"\\07\"; })()}`",
+ SyntaxError);
+})();