@@ -27,6 +27,14 @@ suite("strict mode", function() {
27
27
validExpr ( FE ( exprStmt ( { type : "Literal" , value : "use strict" } ) ) ) ;
28
28
} ) ;
29
29
30
+ test ( "CatchClause param must not be restricted in strict mode" , function ( ) {
31
+ validStmt ( { type : "TryStatement" , block : BLOCK , handler : { type : "CatchClause" , param : { type : "Identifier" , name : "eval" } , body : BLOCK } } ) ;
32
+ validStmt ( { type : "TryStatement" , block : BLOCK , handler : { type : "CatchClause" , param : { type : "Identifier" , name : "arguments" } , body : BLOCK } } ) ;
33
+ validExpr ( strictFE ( { type : "TryStatement" , block : BLOCK , handler : { type : "CatchClause" , param : { type : "Identifier" , name : "x" } , body : BLOCK } } ) ) ;
34
+ invalidExpr ( 1 , strictFE ( { type : "TryStatement" , block : BLOCK , handler : { type : "CatchClause" , param : { type : "Identifier" , name : "eval" } , body : BLOCK } } ) ) ;
35
+ invalidExpr ( 1 , strictFE ( { type : "TryStatement" , block : BLOCK , handler : { type : "CatchClause" , param : { type : "Identifier" , name : "arguments" } , body : BLOCK } } ) ) ;
36
+ } ) ;
37
+
30
38
test ( "Function names must not be restricted in strict mode" , function ( ) {
31
39
validExpr ( strictFE ( exprStmt ( { type : "FunctionExpression" , id : null , params : [ ] , body : BLOCK } ) ) ) ;
32
40
validExpr ( { type : "FunctionExpression" , id : { type : "Identifier" , name : "eval" } , params : [ ] , body : BLOCK } ) ;
0 commit comments