提交 6d28c849 编写于 作者: K kevinluohuan

Chameleon-linter:事件名使用变量且变量未定义情况处理

上级 4dd02f04
...@@ -93,7 +93,7 @@ function getCompClassDef(ast) { ...@@ -93,7 +93,7 @@ function getCompClassDef(ast) {
}; };
} else if (nameArg.isIdentifier()) { } else if (nameArg.isIdentifier()) {
let argBinding = nameArg.scope.getBinding(nameArg.node.name); let argBinding = nameArg.scope.getBinding(nameArg.node.name);
let possibleInit = argBinding.path.node.init; let possibleInit = argBinding ? argBinding.path.node.init : null;
// For now, we only check just one jump along its scope chain. // For now, we only check just one jump along its scope chain.
if (possibleInit && possibleInit.type === 'StringLiteral') { if (possibleInit && possibleInit.type === 'StringLiteral') {
event = { event = {
......
...@@ -159,7 +159,7 @@ module.exports.containerPathVisitor = function(path) { ...@@ -159,7 +159,7 @@ module.exports.containerPathVisitor = function(path) {
}); });
} else if (nameArg.isIdentifier()) { } else if (nameArg.isIdentifier()) {
let argBinding = nameArg.scope.getBinding(nameArg.node.name); let argBinding = nameArg.scope.getBinding(nameArg.node.name);
let possibleInit = argBinding.path.node.init; let possibleInit = argBinding ? argBinding.path.node.init : null;
// For now, we only check just one jump along its scope chain. // For now, we only check just one jump along its scope chain.
if (possibleInit && possibleInit.type === 'StringLiteral') { if (possibleInit && possibleInit.type === 'StringLiteral') {
results.events.push({ results.events.push({
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册