Use getProto and setProto helpers (#7675)

Depends on #7674.
This commit is contained in:
Justin Ridgewell
2018-04-06 02:54:08 +01:00
committed by GitHub
parent e9ed0f5f21
commit 450a1678f2
64 changed files with 117 additions and 126 deletions

View File

@@ -349,20 +349,9 @@ export default function transformClass(
call = t.logicalExpression("||", bareSuperNode, t.thisExpression());
} else {
bareSuperNode = optimiseCall(
t.logicalExpression(
"||",
t.memberExpression(
t.cloneNode(classState.classRef),
t.identifier("__proto__"),
),
t.callExpression(
t.memberExpression(
t.identifier("Object"),
t.identifier("getPrototypeOf"),
),
[t.cloneNode(classState.classRef)],
),
),
t.callExpression(classState.file.addHelper("getPrototypeOf"), [
t.cloneNode(classState.classRef),
]),
t.thisExpression(),
bareSuperNode.arguments,
);