Update Purish aliases (#11267)
* Update Purish aliases - Adds `Purish` to `RegexLiteral`, since it can't cause any side-effects. - Removes `Purish` from `ClassExpression` and `ClassDeclaration`, since they can be impure with static class fields. * Update types
This commit is contained in:
parent
7b9bc7c28b
commit
10058901d0
@ -568,7 +568,7 @@ defineType("BooleanLiteral", {
|
||||
defineType("RegExpLiteral", {
|
||||
builder: ["pattern", "flags"],
|
||||
deprecatedAlias: "RegexLiteral",
|
||||
aliases: ["Expression", "Literal"],
|
||||
aliases: ["Expression", "Pureish", "Literal"],
|
||||
fields: {
|
||||
pattern: {
|
||||
validate: assertValueType("string"),
|
||||
|
||||
@ -124,7 +124,7 @@ defineType("ClassExpression", {
|
||||
"implements",
|
||||
"decorators",
|
||||
],
|
||||
aliases: ["Scopable", "Class", "Expression", "Pureish"],
|
||||
aliases: ["Scopable", "Class", "Expression"],
|
||||
fields: {
|
||||
id: {
|
||||
validate: assertNodeType("Identifier"),
|
||||
@ -175,7 +175,7 @@ defineType("ClassExpression", {
|
||||
|
||||
defineType("ClassDeclaration", {
|
||||
inherits: "ClassExpression",
|
||||
aliases: ["Scopable", "Class", "Statement", "Declaration", "Pureish"],
|
||||
aliases: ["Scopable", "Class", "Statement", "Declaration"],
|
||||
fields: {
|
||||
declare: {
|
||||
validate: assertValueType("boolean"),
|
||||
|
||||
@ -3847,9 +3847,8 @@ export function isPureish(node: ?Object, opts?: Object): boolean {
|
||||
"NumericLiteral" === nodeType ||
|
||||
"NullLiteral" === nodeType ||
|
||||
"BooleanLiteral" === nodeType ||
|
||||
"RegExpLiteral" === nodeType ||
|
||||
"ArrowFunctionExpression" === nodeType ||
|
||||
"ClassExpression" === nodeType ||
|
||||
"ClassDeclaration" === nodeType ||
|
||||
"BigIntLiteral" === nodeType ||
|
||||
(nodeType === "Placeholder" && "StringLiteral" === node.expectedNode)
|
||||
) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user