Revert "Mark ThisExpression and Super as Purish" (#12307)
This commit is contained in:
parent
7a8c63d8db
commit
dd5a977048
@ -232,19 +232,6 @@ describe("scope", () => {
|
|||||||
expect(
|
expect(
|
||||||
getPath("String.raw`foo`").get("body")[0].get("expression").isPure(),
|
getPath("String.raw`foo`").get("body")[0].get("expression").isPure(),
|
||||||
).toBeTruthy();
|
).toBeTruthy();
|
||||||
expect(getPath("this").get("body.0.expression").isPure()).toBeTruthy();
|
|
||||||
expect(getPath("this.foo").get("body.0.expression").isPure()).toBeFalsy();
|
|
||||||
expect(
|
|
||||||
getPath("({ m() { super.foo } })")
|
|
||||||
.get("body.0.expression.properties.0.body.body.0.expression")
|
|
||||||
.isPure(),
|
|
||||||
).toBeFalsy();
|
|
||||||
expect(
|
|
||||||
// This only tests "super", not "super.foo"
|
|
||||||
getPath("({ m() { super.foo } })")
|
|
||||||
.get("body.0.expression.properties.0.body.body.0.expression.object")
|
|
||||||
.isPure(),
|
|
||||||
).toBeTruthy();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test("label", function () {
|
test("label", function () {
|
||||||
|
|||||||
@ -980,7 +980,7 @@ defineType("SwitchStatement", {
|
|||||||
});
|
});
|
||||||
|
|
||||||
defineType("ThisExpression", {
|
defineType("ThisExpression", {
|
||||||
aliases: ["Expression", "Pureish"],
|
aliases: ["Expression"],
|
||||||
});
|
});
|
||||||
|
|
||||||
defineType("ThrowStatement", {
|
defineType("ThrowStatement", {
|
||||||
@ -1806,7 +1806,7 @@ defineType("SpreadElement", {
|
|||||||
});
|
});
|
||||||
|
|
||||||
defineType("Super", {
|
defineType("Super", {
|
||||||
aliases: ["Expression", "Pureish"],
|
aliases: ["Expression"],
|
||||||
});
|
});
|
||||||
|
|
||||||
defineType("TaggedTemplateExpression", {
|
defineType("TaggedTemplateExpression", {
|
||||||
|
|||||||
@ -3965,9 +3965,7 @@ export function isPureish(node: ?Object, opts?: Object): boolean {
|
|||||||
"NullLiteral" === nodeType ||
|
"NullLiteral" === nodeType ||
|
||||||
"BooleanLiteral" === nodeType ||
|
"BooleanLiteral" === nodeType ||
|
||||||
"RegExpLiteral" === nodeType ||
|
"RegExpLiteral" === nodeType ||
|
||||||
"ThisExpression" === nodeType ||
|
|
||||||
"ArrowFunctionExpression" === nodeType ||
|
"ArrowFunctionExpression" === nodeType ||
|
||||||
"Super" === nodeType ||
|
|
||||||
"BigIntLiteral" === nodeType ||
|
"BigIntLiteral" === nodeType ||
|
||||||
"DecimalLiteral" === nodeType ||
|
"DecimalLiteral" === nodeType ||
|
||||||
(nodeType === "Placeholder" && "StringLiteral" === node.expectedNode)
|
(nodeType === "Placeholder" && "StringLiteral" === node.expectedNode)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user