refactor: move @babel/helper-validator-identifier to ts (#12409)
* refactor: rename helper-validator-identifier to ts * fix flow errors
This commit is contained in:
@@ -522,7 +522,7 @@ defineType("Identifier", {
|
||||
// Ideally we should call isStrictReservedWord if this node is a descendant
|
||||
// of a block in strict mode. Also, we should pass the inModule option so
|
||||
// we can disable "await" in module.
|
||||
(isKeyword(node.name) || isReservedWord(node.name)) &&
|
||||
(isKeyword(node.name) || isReservedWord(node.name, false)) &&
|
||||
// Even if "this" is a keyword, we are using the Identifier
|
||||
// node to represent it.
|
||||
node.name !== "this"
|
||||
|
||||
@@ -15,10 +15,8 @@ export default function isValidIdentifier(
|
||||
if (typeof name !== "string") return false;
|
||||
|
||||
if (reserved) {
|
||||
if (isKeyword(name) || isStrictReservedWord(name)) {
|
||||
return false;
|
||||
} else if (name === "await") {
|
||||
// invalid in module, valid in script; better be safe (see #4952)
|
||||
// "await" is invalid in module, valid in script; better be safe (see #4952)
|
||||
if (isKeyword(name) || isStrictReservedWord(name, true)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user