Skip to content

Commit

Permalink
Use a more efficient AST visitor
Browse files Browse the repository at this point in the history
  • Loading branch information
sgtcoolguy committed Apr 24, 2017
1 parent c61a6e6 commit 196118f
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions lib/jsanalyze.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,6 @@ function getMemberValue(node) {
}

function getTitaniumExpression(member) {
// not a member expression
if (!types.isMemberExpression(member)) return null;

var value = getMemberValue(member),
tiNodeRegExp = /^Ti(tanium)?/;
if (value == null) return null;
Expand Down Expand Up @@ -142,8 +139,8 @@ exports.analyzeJs = function analyzeJs(contents, opts) {

// find all of the titanium symbols
traverse(ast, {
enter(path) {
if (types.isMemberExpression(path.node)) {
MemberExpression: {
enter: function(path) {
var memberExpr = getTitaniumExpression(path.node);
if (memberExpr) {
symbols[memberExpr.substring(9)] = 1; // Drop leading 'Titanium.'
Expand Down

0 comments on commit 196118f

Please sign in to comment.