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", {
|
defineType("RegExpLiteral", {
|
||||||
builder: ["pattern", "flags"],
|
builder: ["pattern", "flags"],
|
||||||
deprecatedAlias: "RegexLiteral",
|
deprecatedAlias: "RegexLiteral",
|
||||||
aliases: ["Expression", "Literal"],
|
aliases: ["Expression", "Pureish", "Literal"],
|
||||||
fields: {
|
fields: {
|
||||||
pattern: {
|
pattern: {
|
||||||
validate: assertValueType("string"),
|
validate: assertValueType("string"),
|
||||||
|
|||||||
@ -124,7 +124,7 @@ defineType("ClassExpression", {
|
|||||||
"implements",
|
"implements",
|
||||||
"decorators",
|
"decorators",
|
||||||
],
|
],
|
||||||
aliases: ["Scopable", "Class", "Expression", "Pureish"],
|
aliases: ["Scopable", "Class", "Expression"],
|
||||||
fields: {
|
fields: {
|
||||||
id: {
|
id: {
|
||||||
validate: assertNodeType("Identifier"),
|
validate: assertNodeType("Identifier"),
|
||||||
@ -175,7 +175,7 @@ defineType("ClassExpression", {
|
|||||||
|
|
||||||
defineType("ClassDeclaration", {
|
defineType("ClassDeclaration", {
|
||||||
inherits: "ClassExpression",
|
inherits: "ClassExpression",
|
||||||
aliases: ["Scopable", "Class", "Statement", "Declaration", "Pureish"],
|
aliases: ["Scopable", "Class", "Statement", "Declaration"],
|
||||||
fields: {
|
fields: {
|
||||||
declare: {
|
declare: {
|
||||||
validate: assertValueType("boolean"),
|
validate: assertValueType("boolean"),
|
||||||
|
|||||||
@ -3847,9 +3847,8 @@ export function isPureish(node: ?Object, opts?: Object): boolean {
|
|||||||
"NumericLiteral" === nodeType ||
|
"NumericLiteral" === nodeType ||
|
||||||
"NullLiteral" === nodeType ||
|
"NullLiteral" === nodeType ||
|
||||||
"BooleanLiteral" === nodeType ||
|
"BooleanLiteral" === nodeType ||
|
||||||
|
"RegExpLiteral" === nodeType ||
|
||||||
"ArrowFunctionExpression" === nodeType ||
|
"ArrowFunctionExpression" === nodeType ||
|
||||||
"ClassExpression" === nodeType ||
|
|
||||||
"ClassDeclaration" === nodeType ||
|
|
||||||
"BigIntLiteral" === nodeType ||
|
"BigIntLiteral" === nodeType ||
|
||||||
(nodeType === "Placeholder" && "StringLiteral" === node.expectedNode)
|
(nodeType === "Placeholder" && "StringLiteral" === node.expectedNode)
|
||||||
) {
|
) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user