File tree Expand file tree Collapse file tree
test/configCases/parsing/strict-mode-module-output-bindings Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4379,6 +4379,16 @@ class JavascriptParser extends Parser {
43794379 } ;
43804380 const { params, type } = functionExpression ;
43814381 const arrow = type === "ArrowFunctionExpression" ;
4382+ // the walk skips walkFunctionExpression for a called function expression
4383+ if ( this . _strictInModuleOutput ) {
4384+ this . _checkStrictModeParams ( params ) ;
4385+ if ( type === "FunctionExpression" && functionExpression . id ) {
4386+ this . _checkStrictModeBinding (
4387+ functionExpression . id . name ,
4388+ functionExpression . id
4389+ ) ;
4390+ }
4391+ }
43824392 const renameThis = currentThis ? getVarInfo ( currentThis ) : null ;
43834393 const varInfoForArgs = options . map ( getVarInfo ) ;
43844394 const wasTopLevel = this . scope . topLevelScope ;
Original file line number Diff line number Diff line change @@ -40,6 +40,15 @@ function awaitParam(await) {
4040// A named class expression binds its name, same as a declaration.
4141var namedClass = class await { } ;
4242
43+ // A called function expression is walked as an IIFE, not through
44+ // walkFunctionExpression.
45+ var iifeName = ( function yield ( ) {
46+ return 1 ;
47+ } ) ( ) ;
48+ var iifeParam = ( function ( static ) {
49+ return static ;
50+ } ) ( 1 ) ;
51+
4352// Unaffected: reserved words are valid as property and method names.
4453var properties = { static : 1 , public : 2 , await : 3 } ;
4554var readsProperty = properties . static + properties . public ;
@@ -60,6 +69,8 @@ module.exports = {
6069 arrowParam,
6170 awaitParam,
6271 namedClass,
72+ iifeName,
73+ iifeParam,
6374 readsProperty,
6475 normalBinding
6576} ;
Original file line number Diff line number Diff line change @@ -36,5 +36,17 @@ module.exports = [
3636 }
3737 ] ,
3838 [ { message : / " a w a i t " i s n o t a l l o w e d a s a p a r a m e t e r n a m e / } ] ,
39- [ { message : / " a w a i t " i s n o t a l l o w e d a s a b i n d i n g n a m e / } ]
39+ [ { message : / " a w a i t " i s n o t a l l o w e d a s a b i n d i n g n a m e / } ] ,
40+ [
41+ {
42+ message :
43+ / " y i e l d " i s a r e s e r v e d w o r d i n s t r i c t m o d e a n d i s n o t a l l o w e d a s a b i n d i n g n a m e /
44+ }
45+ ] ,
46+ [
47+ {
48+ message :
49+ / " s t a t i c " i s a r e s e r v e d w o r d i n s t r i c t m o d e a n d i s n o t a l l o w e d a s a p a r a m e t e r n a m e /
50+ }
51+ ]
4052] ;
You can’t perform that action at this time.
0 commit comments