Skip to content
This repository has been archived by the owner on Oct 15, 2020. It is now read-only.

Commit

Permalink
deps: update ChakraCore to chakra-core/ChakraCore@51c6097dd4
Browse files Browse the repository at this point in the history
[MERGE #5569 @aneeshdk] OS:18468078:Adding a check for the case where lambda method accessing super in global scope

Merge pull request #5569 from aneeshdk:SuperGlobalAccessIssue

When a labmda method access super property in the global scope the currentnonlambdafunc will be nullptr. This should be a SyntaxError.

Reviewed-By: chakrabot <[email protected]>
  • Loading branch information
aneeshdk authored and kfarnung committed Aug 16, 2018
1 parent 28a6c92 commit 586cde9
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion deps/chakrashim/core/lib/Parser/Parse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12323,7 +12323,7 @@ IdentPtr Parser::ParseSuper(bool fAllowCall)
{
// Any super access is good within a class constructor
}
else if ((this->m_grfscr & fscrEval) == fscrEval || currentNonLambdaFunc->superRestrictionState == SuperRestrictionState::PropertyAllowed)
else if ((this->m_grfscr & fscrEval) == fscrEval || (currentNonLambdaFunc != nullptr && currentNonLambdaFunc->superRestrictionState == SuperRestrictionState::PropertyAllowed))
{
// Currently for eval cases during compile time we use propertyallowed and throw during runtime for error cases
if (m_token.tk == tkLParen)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SyntaxError: Invalid use of the 'super' keyword
at code (SuperAccessInGlobalLambda.js:6:12)
6 changes: 6 additions & 0 deletions deps/chakrashim/core/test/Bugs/SuperAccessInGlobalLambda.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
//-------------------------------------------------------------------------------------------------------
// Copyright (C) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
//-------------------------------------------------------------------------------------------------------

() => super.a;
7 changes: 7 additions & 0 deletions deps/chakrashim/core/test/Bugs/rlexe.xml
Original file line number Diff line number Diff line change
Expand Up @@ -523,4 +523,11 @@
<compile-flags>-force:cachedScope</compile-flags>
</default>
</test>
<test>
<default>
<files>SuperAccessInGlobalLambda.js</files>
<baseline>SuperAccessInGlobalLambda.baseline</baseline>
<tags>exclude_jshost</tags>
</default>
</test>
</regress-exe>

0 comments on commit 586cde9

Please sign in to comment.