Delete useless check for variable redeclaration (#14129)
This commit is contained in:
parent
04f3f17556
commit
335622f75d
@ -2,7 +2,7 @@ import type NodePath from "../path";
|
|||||||
import type * as t from "@babel/types";
|
import type * as t from "@babel/types";
|
||||||
import type Scope from "./index";
|
import type Scope from "./index";
|
||||||
|
|
||||||
type BindingKind =
|
export type BindingKind =
|
||||||
| "var" /* var declarator */
|
| "var" /* var declarator */
|
||||||
| "let" /* let declarator, class declaration id, catch clause parameters */
|
| "let" /* let declarator, class declaration id, catch clause parameters */
|
||||||
| "const" /* const declarator */
|
| "const" /* const declarator */
|
||||||
|
|||||||
@ -3,6 +3,7 @@ import type NodePath from "../path";
|
|||||||
import traverse from "../index";
|
import traverse from "../index";
|
||||||
import type { TraverseOptions } from "../index";
|
import type { TraverseOptions } from "../index";
|
||||||
import Binding from "./binding";
|
import Binding from "./binding";
|
||||||
|
import type { BindingKind } from "./binding";
|
||||||
import globals from "globals";
|
import globals from "globals";
|
||||||
import {
|
import {
|
||||||
NOT_LOCAL_BINDING,
|
NOT_LOCAL_BINDING,
|
||||||
@ -569,7 +570,7 @@ export default class Scope {
|
|||||||
|
|
||||||
checkBlockScopedCollisions(
|
checkBlockScopedCollisions(
|
||||||
local: Binding,
|
local: Binding,
|
||||||
kind: string,
|
kind: BindingKind,
|
||||||
name: string,
|
name: string,
|
||||||
id: any,
|
id: any,
|
||||||
) {
|
) {
|
||||||
@ -587,7 +588,7 @@ export default class Scope {
|
|||||||
local.kind === "const" ||
|
local.kind === "const" ||
|
||||||
local.kind === "module" ||
|
local.kind === "module" ||
|
||||||
// don't allow a local of param with a kind of let
|
// don't allow a local of param with a kind of let
|
||||||
(local.kind === "param" && (kind === "let" || kind === "const"));
|
(local.kind === "param" && kind === "const");
|
||||||
|
|
||||||
if (duplicate) {
|
if (duplicate) {
|
||||||
throw this.hub.buildError(
|
throw this.hub.buildError(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user