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:
@@ -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,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user