Skip to content

Commit

Permalink
Merge r244038 - Unreviewed, rolling in r243948 with test fix
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=196486

JSTests:

* stress/arrow-function-and-use-strict-directive.js: Added.
* stress/arrow-function-syntax.js: Added.
(checkSyntax):
(checkSyntaxError):

Source/JavaScriptCore:

* parser/ASTBuilder.h:
(JSC::ASTBuilder::createString):
* parser/Lexer.cpp:
(JSC::Lexer<T>::parseMultilineComment):
(JSC::Lexer<T>::lexWithoutClearingLineTerminator):
(JSC::Lexer<T>::lex): Deleted.
* parser/Lexer.h:
(JSC::Lexer::hasLineTerminatorBeforeToken const):
(JSC::Lexer::setHasLineTerminatorBeforeToken):
(JSC::Lexer<T>::lex):
(JSC::Lexer::prevTerminator const): Deleted.
(JSC::Lexer::setTerminator): Deleted.
* parser/Parser.cpp:
(JSC::Parser<LexerType>::allowAutomaticSemicolon):
(JSC::Parser<LexerType>::parseSingleFunction):
(JSC::Parser<LexerType>::parseStatementListItem):
(JSC::Parser<LexerType>::maybeParseAsyncFunctionDeclarationStatement):
(JSC::Parser<LexerType>::parseFunctionInfo):
(JSC::Parser<LexerType>::parseClass):
(JSC::Parser<LexerType>::parseExportDeclaration):
(JSC::Parser<LexerType>::parseAssignmentExpression):
(JSC::Parser<LexerType>::parseYieldExpression):
(JSC::Parser<LexerType>::parseProperty):
(JSC::Parser<LexerType>::parsePrimaryExpression):
(JSC::Parser<LexerType>::parseMemberExpression):
* parser/Parser.h:
(JSC::Parser::nextWithoutClearingLineTerminator):
(JSC::Parser::lexCurrentTokenAgainUnderCurrentContext):
(JSC::Parser::internalSaveLexerState):
(JSC::Parser::restoreLexerState):

LayoutTests:

The test relied on the wrong EOF token's offset. This patch also fixes the test.

* inspector/runtime/parse-expected.txt:
* inspector/runtime/parse.html:
  • Loading branch information
Constellation authored and carlosgcampos committed May 9, 2019
1 parent 927fea4 commit e1957c5
Show file tree
Hide file tree
Showing 12 changed files with 288 additions and 144 deletions.
10 changes: 10 additions & 0 deletions JSTests/ChangeLog
@@ -1,3 +1,13 @@
2019-04-08 Yusuke Suzuki <ysuzuki@apple.com>

Unreviewed, rolling in r243948 with test fix
https://bugs.webkit.org/show_bug.cgi?id=196486

* stress/arrow-function-and-use-strict-directive.js: Added.
* stress/arrow-function-syntax.js: Added.
(checkSyntax):
(checkSyntaxError):

2019-04-04 Saam Barati <sbarati@apple.com>

Unreviewed. Make the test from r243906 catch the thrown exceptions.
Expand Down
18 changes: 18 additions & 0 deletions JSTests/stress/arrow-function-and-use-strict-directive.js
@@ -0,0 +1,18 @@
// This test should not crash.

dispatch => accessible.children()
"use strict";

dispatch2 => accessible.children()
"use strict"

var protected = 42;

dispatch3 => "use strict"
protected;

async dispatch4 => hey
"use strict";

async dispatch4 => "use strict"
protected;
27 changes: 27 additions & 0 deletions JSTests/stress/arrow-function-syntax.js
@@ -0,0 +1,27 @@
function checkSyntax(src) {
try {
eval(src);
} catch (error) {
if (error instanceof SyntaxError)
throw new Error("Syntax Error: " + String(error) + "\n script: `" + src + "`");
}
}

function checkSyntaxError(src, message) {
var bError = false;
try {
eval(src);
} catch (error) {
bError = error instanceof SyntaxError && (String(error) === message || typeof message === 'undefined');
}
if (!bError) {
throw new Error("Expected syntax Error: " + message + "\n in script: `" + src + "`");
}
}

checkSyntax(`()=>42`);
checkSyntax(`()=>42
`);
checkSyntax(`()=>42//Hello`);
checkSyntax(`()=>42//Hello
`);
10 changes: 10 additions & 0 deletions LayoutTests/ChangeLog
@@ -1,3 +1,13 @@
2019-04-08 Yusuke Suzuki <ysuzuki@apple.com>

Unreviewed, rolling in r243948 with test fix
https://bugs.webkit.org/show_bug.cgi?id=196486

The test relied on the wrong EOF token's offset. This patch also fixes the test.

* inspector/runtime/parse-expected.txt:
* inspector/runtime/parse.html:

2019-04-25 Philippe Normand <pnormand@igalia.com>

[GStreamer] gst_element_get_state: assertion 'GST_IS_ELEMENT (element)' failed in WebCore::MediaPlayerPrivateGStreamer::paused
Expand Down

0 comments on commit e1957c5

Please sign in to comment.