Cleanup object super traversal (#7681)

This commit is contained in:
Justin Ridgewell 2018-04-06 20:39:57 +01:00 committed by GitHub
parent 3f72f1d637
commit 637bfe76b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -25,20 +25,16 @@ export default declare(api => {
const getObjectRef = () => const getObjectRef = () =>
(objectRef = objectRef || path.scope.generateUidIdentifier("obj")); (objectRef = objectRef || path.scope.generateUidIdentifier("obj"));
path.get("properties").forEach(propertyPath => { path.get("properties").forEach(propPath => {
if (!propertyPath.isMethod()) return; if (!propPath.isMethod()) return;
const propPaths: Array = path.get("properties"); replacePropertySuper(
for (let propPath of propPaths) { propPath,
if (propPath.isObjectProperty()) propPath = propPath.get("value"); propPath.node,
replacePropertySuper( path.scope,
propPath, getObjectRef,
propPath.node, state,
path.scope, );
getObjectRef,
state,
);
}
}); });
if (objectRef) { if (objectRef) {