forked from facebook/hermes
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't allow catch to bind to eval or arguments in strict mode
Summary: Implement a point in [section C](https://tc39.es/ecma262/multipage/strict-mode-of-ecmascript.html#sec-strict-mode-of-ecmascript) of the spec. > It is a SyntaxError if a CatchParameter occurs within strict mode code and BoundNames of CatchParameter contains either `eval` or `arguments` Perform this check in the `SemanticValidator`. Reviewed By: jpporto Differential Revision: D41864654 fbshipit-source-id: 0aaf981965c02a347052fe43047fa0dd4630b9b0
- Loading branch information
1 parent
f6b56d3
commit 838d1e4
Showing
3 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/** | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
// RUN: %hermes %s | %FileCheck --match-full-lines %s | ||
'use strict'; | ||
|
||
print("catch"); | ||
//CHECK-LABEL: catch | ||
|
||
try { | ||
eval('try{}catch(eval){}') | ||
} catch (err){ | ||
print(err instanceof SyntaxError); | ||
} | ||
//CHECK-NEXT: true | ||
try { | ||
eval('try{}catch(arguments){}') | ||
} catch (err){ | ||
print(err instanceof SyntaxError); | ||
} | ||
//CHECK-NEXT: true |