@@ -1201,6 +1201,59 @@ describe ('Import Live Bindings (reference)', () => {
12011201 ] . join ( '\n' ) ) ;
12021202 } ) ;
12031203
1204+ it ( 'should allow shadowing by function declaration array pattern params' , async ( ) => {
1205+ let res = await resolve ( [
1206+ 'import MyDefault, { MyVar } from "./myfile";' ,
1207+ 'function MyFunction ([MyDefault]) {' ,
1208+ ' console.log(MyDefault, MyVar);' ,
1209+ '}' ,
1210+ 'console.log(MyDefault);'
1211+ ] ) ;
1212+ expect ( res ) . to . equal ( [
1213+ ' ' ,
1214+ 'function MyFunction ([MyDefault]) {' ,
1215+ ' console.log(MyDefault, __i__.MyVar);' ,
1216+ '}' ,
1217+ 'console.log(__i__.MyDefault);'
1218+ ] . join ( '\n' ) ) ;
1219+ } ) ;
1220+
1221+
1222+ it ( 'should allow shadowing by function declaration object pattern params' , async ( ) => {
1223+ let res = await resolve ( [
1224+ 'import MyDefault, { MyVar } from "./myfile";' ,
1225+ 'function MyFunction ({MyDefault}) {' ,
1226+ ' console.log(MyDefault, MyVar);' ,
1227+ '}' ,
1228+ 'console.log(MyDefault);'
1229+ ] ) ;
1230+ expect ( res ) . to . equal ( [
1231+ ' ' ,
1232+ 'function MyFunction ({MyDefault}) {' ,
1233+ ' console.log(MyDefault, __i__.MyVar);' ,
1234+ '}' ,
1235+ 'console.log(__i__.MyDefault);'
1236+ ] . join ( '\n' ) ) ;
1237+ } ) ;
1238+
1239+
1240+ it ( 'should allow shadowing by function declaration array pattern params arrow function' , async ( ) => {
1241+ let res = await resolve ( [
1242+ 'import MyDefault, { MyVar } from "./myfile";' ,
1243+ 'let MyFunction = ([MyDefault]) => {' ,
1244+ ' console.log(MyDefault, MyVar);' ,
1245+ '}' ,
1246+ 'console.log(MyDefault);'
1247+ ] ) ;
1248+ expect ( res ) . to . equal ( [
1249+ ' ' ,
1250+ 'let MyFunction = ([MyDefault]) => {' ,
1251+ ' console.log(MyDefault, __i__.MyVar);' ,
1252+ '}' ,
1253+ 'console.log(__i__.MyDefault);'
1254+ ] . join ( '\n' ) ) ;
1255+ } ) ;
1256+
12041257 it ( 'should allow shadowing by function names' , async ( ) => {
12051258 let res = await resolve ( [
12061259 'import MyDefault from "./myfile";' ,
0 commit comments