Skip to content

Commit

Permalink
Revert "Mark ThisExpression and Super as Purish" (#12307)
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolo-ribaudo committed Nov 4, 2020
1 parent 7a8c63d commit dd5a977
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 17 deletions.
13 changes: 0 additions & 13 deletions packages/babel-traverse/test/scope.js
Expand Up @@ -232,19 +232,6 @@ describe("scope", () => {
expect(
getPath("String.raw`foo`").get("body")[0].get("expression").isPure(),
).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 () {
Expand Down
4 changes: 2 additions & 2 deletions packages/babel-types/src/definitions/core.js
Expand Up @@ -980,7 +980,7 @@ defineType("SwitchStatement", {
});

defineType("ThisExpression", {
aliases: ["Expression", "Pureish"],
aliases: ["Expression"],
});

defineType("ThrowStatement", {
Expand Down Expand Up @@ -1806,7 +1806,7 @@ defineType("SpreadElement", {
});

defineType("Super", {
aliases: ["Expression", "Pureish"],
aliases: ["Expression"],
});

defineType("TaggedTemplateExpression", {
Expand Down
2 changes: 0 additions & 2 deletions packages/babel-types/src/validators/generated/index.js
Expand Up @@ -3965,9 +3965,7 @@ export function isPureish(node: ?Object, opts?: Object): boolean {
"NullLiteral" === nodeType ||
"BooleanLiteral" === nodeType ||
"RegExpLiteral" === nodeType ||
"ThisExpression" === nodeType ||
"ArrowFunctionExpression" === nodeType ||
"Super" === nodeType ||
"BigIntLiteral" === nodeType ||
"DecimalLiteral" === nodeType ||
(nodeType === "Placeholder" && "StringLiteral" === node.expectedNode)
Expand Down

0 comments on commit dd5a977

Please sign in to comment.