Skip to content

Commit

Permalink
[MERGE #1468 @ianwjhalliday] Fix call syntax after class expression s…
Browse files Browse the repository at this point in the history
…yntax

Merge pull request #1468 from ianwjhalliday:fix1465

Call syntax was being disallowed after a call expression.  Appears to be
a mistake, perhaps copy and paste error.  Fix by simply remove line
disallowing call syntax in class expression parsing.

Fixes #1465
  • Loading branch information
Ian Halliday committed Aug 19, 2016
2 parents e9299de + 6f91c8b commit 07d12c6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
1 change: 0 additions & 1 deletion lib/Parser/Parse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3146,7 +3146,6 @@ LFunction :
}

case tkCLASS:
fAllowCall = FALSE;
if (m_scriptContext->GetConfig()->IsES6ClassAndExtendsEnabled())
{
pnode = ParseClassDecl<buildAST>(FALSE, pNameHint, pHintLength, pShortNameOffset);
Expand Down
12 changes: 12 additions & 0 deletions test/es6/classes_bugfixes.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,18 @@
WScript.LoadScriptFile("..\\UnitTestFramework\\UnitTestFramework.js");

var tests = [
{
name: "GitHub ChakraCore #1465 - call syntax is allowed after class expression",
body: function () {
var s1 = class { }.toString();
var s2 = class x { }.toString();
var s3 = class x { }.toString(1, 2, 3); // arguments should not affect valid parse

assert.areEqual("class { }", s1, "Calling toString after a class expression with no name parses and behaves correctly");
assert.areEqual("class x { }", s2, "Calling toString after a class expression with a name parses and behaves correctly");
assert.areEqual("class x { }", s3, "Calling toString with arguments after a class expression with a name parses and behaves correctly");
}
},
{
name: "BLUE 540289: AV on deferred parse of first class method",
body: function () {
Expand Down

0 comments on commit 07d12c6

Please sign in to comment.