Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | 8x 20x 8x 8x 20x 20x | export class DestructuringErrors {
public shorthandAssign: number
public trailingComma: number
public parenthesizedAssign: number
public parenthesizedBind: number
public doubleProto: number
constructor() {
this.shorthandAssign =
this.trailingComma =
this.parenthesizedAssign =
this.parenthesizedBind =
this.doubleProto = -1
}
}
export function isPrivateNameConflicted(privateNameMap, element) {
const name = element.key.name
const curr = privateNameMap[name]
let next = "true"
if (element.type === "MethodDefinition" && (element.kind === "get" || element.kind === "set")) {
next = (element.static ? "s" : "i") + element.kind
}
// `class { get #a(){}; static set #a(_){} }` is also conflict.
if (
curr === "iget" && next === "iset" ||
curr === "iset" && next === "iget" ||
curr === "sget" && next === "sset" ||
curr === "sset" && next === "sget"
) {
privateNameMap[name] = "true"
return false
} else if (!curr) {
privateNameMap[name] = next
return false
} else {
return true
}
}
export function checkKeyName(node, name) {
const {computed, key} = node
return !computed && (
key.type === "Identifier" && key.name === name ||
key.type === "Literal" && key.value === name
)
}
|