From 6d28c849b9727a77d29544a006f01d0e63c71721 Mon Sep 17 00:00:00 2001 From: kevinluohuan Date: Thu, 13 Jun 2019 16:46:59 +0800 Subject: [PATCH] =?UTF-8?q?Chameleon-linter=EF=BC=9A=E4=BA=8B=E4=BB=B6?= =?UTF-8?q?=E5=90=8D=E4=BD=BF=E7=94=A8=E5=8F=98=E9=87=8F=E4=B8=94=E5=8F=98?= =?UTF-8?q?=E9=87=8F=E6=9C=AA=E5=AE=9A=E4=B9=89=E6=83=85=E5=86=B5=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/chameleon-linter/checkers/script.js | 2 +- packages/cml-js-parser/src/visitors/containerPathVisitor.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/chameleon-linter/checkers/script.js b/packages/chameleon-linter/checkers/script.js index f265f23f..ad9b8b5a 100644 --- a/packages/chameleon-linter/checkers/script.js +++ b/packages/chameleon-linter/checkers/script.js @@ -93,7 +93,7 @@ function getCompClassDef(ast) { }; } else if (nameArg.isIdentifier()) { 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. if (possibleInit && possibleInit.type === 'StringLiteral') { event = { diff --git a/packages/cml-js-parser/src/visitors/containerPathVisitor.js b/packages/cml-js-parser/src/visitors/containerPathVisitor.js index c99594c2..999528bd 100644 --- a/packages/cml-js-parser/src/visitors/containerPathVisitor.js +++ b/packages/cml-js-parser/src/visitors/containerPathVisitor.js @@ -159,7 +159,7 @@ module.exports.containerPathVisitor = function(path) { }); } else if (nameArg.isIdentifier()) { 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. if (possibleInit && possibleInit.type === 'StringLiteral') { results.events.push({ -- GitLab