提交 9346f034 编写于 作者: Q qiang

fix: 修正局部变量查找

上级 96443dee
......@@ -126,7 +126,7 @@ module.exports = {
Identifier (path) {
const node = path.node
const name = node.name
if (names.includes(name) && path.key !== 'key' && path.key !== 'property' && !(path.scope && path.scope.hasBinding(name))) {
if (names.includes(name) && path.key !== 'key' && (path.key !== 'property' || path.parent.computed) && !(path.scope && path.scope.hasBinding(name))) {
path.replaceWithSourceString(`${paramName}.${name}`)
}
}
......
......@@ -335,7 +335,7 @@ function parseEvent (keyPath, valuePath, state, isComponent, isNativeOn = false,
const scope = path.scope
const node = path.node
const name = node.name
if (path.key !== 'key' && path.key !== 'property' && scope && !scope.hasOwnBinding(name) && scope.hasBinding(name)) {
if (path.key !== 'key' && (path.key !== 'property' || path.parent.computed) && scope && !scope.hasOwnBinding(name) && scope.hasBinding(name)) {
params.push(name)
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册