Skip to content

Commit b8dcb00

Browse files
committed
feature: @putout/plugin-putout: convert-node-to-path-in-get-template-values: exclude parentPath
1 parent 8bd871a commit b8dcb00

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,12 @@
11
const x = getTemplateValues(path.parentPath, '__a * __b');
2+
3+
export const match = () => ({
4+
'if (!__a) __b': ({__a, __b}, path) => {
5+
const {parentPath} = path.parentPath;
6+
const {argument} = __a;
7+
8+
console.log(getTemplateValues(parentPath, 'while (__c = __d) __body'), 'x');
9+
10+
return compare(parentPath, `while (${argument.name} = __d) __body`);
11+
}
12+
});

packages/plugin-putout/lib/convert-node-to-path-in-get-template-values/index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ module.exports.traverse = ({push}) => ({
4444
}
4545

4646
const {name} = __aPath.node;
47+
48+
if (name === 'parentPath')
49+
return;
50+
4751
const binding = bindings[name];
4852

4953
if (!binding)

0 commit comments

Comments
 (0)