fix: Exclude catch clause from let identifier error (#10559)

* Exclude catch clause from let identifier error

* Disallow let binding based on parameter

* Add test

* Remove unused getter

* Update packages/babel-parser/src/parser/statement.js

Co-Authored-By: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
This commit is contained in:
gr
2019-10-17 04:30:36 -03:00
committed by Nicolò Ribaudo
parent 487f10f84d
commit 095f28a913
7 changed files with 139 additions and 3 deletions

View File

@@ -108,6 +108,7 @@ export default (superClass: Class<Parser>): Class<Parser> =>
bindingType: BindingTypes = BIND_NONE,
checkClashes: ?{ [key: string]: boolean },
contextDescription: string,
disallowLetBinding?: boolean,
): void {
switch (expr.type) {
case "ObjectPattern":
@@ -117,11 +118,18 @@ export default (superClass: Class<Parser>): Class<Parser> =>
bindingType,
checkClashes,
"object destructuring pattern",
disallowLetBinding,
);
});
break;
default:
super.checkLVal(expr, bindingType, checkClashes, contextDescription);
super.checkLVal(
expr,
bindingType,
checkClashes,
contextDescription,
disallowLetBinding,
);
}
}