Skip to content
This repository was archived by the owner on Dec 4, 2021. It is now read-only.

Commit 43b0213

Browse files
Caleb HooverCaleb Hoover
Caleb Hoover
authored and
Caleb Hoover
committed
works more
1 parent dfffafd commit 43b0213

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

check.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ Scope = module.exports.Scope = function(scope) {
106106
this.sinks = scope.sinks||sinks;
107107
this.file = scope.file;
108108
this.log = scope.log || log;
109+
this.createNewScope = scope.createNewScope;
110+
this.leaveScope = scope.leaveScope;
109111

110112
};
111113

@@ -502,6 +504,14 @@ Scope.prototype.resolveFunctionExpression = function(node) {
502504
// Traverses an array of statments.
503505
Scope.prototype.traverse = function(ast, returnCB) {
504506
var scope = this;
507+
if (flags.verbose) {
508+
(scope.createNewScope || function() {
509+
console.log('Creating new scope'.yellow);
510+
})();
511+
scope.log('SOURCES', ast, scope.sources);
512+
}
513+
514+
505515
if (ast.type == 'BlockStatement'){
506516
(ast.body || [ast]).forEach(function (node) {
507517
if (node.type == 'ExpressionStatement')
@@ -515,6 +525,11 @@ Scope.prototype.traverse = function(ast, returnCB) {
515525
// ast is a single statement so resolve it instead
516526
this.resolveStatement(ast.expression || ast);
517527
}
528+
529+
if (flags.verbose)
530+
(scope.leaveScope || function () {
531+
console.log('leaving scope'.yellow);
532+
})();
518533
};
519534

520535
Scope.prototype.resolvePath = function(file, cb) {

0 commit comments

Comments
 (0)