This repository was archived by the owner on Dec 4, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -106,6 +106,8 @@ Scope = module.exports.Scope = function(scope) {
106
106
this . sinks = scope . sinks || sinks ;
107
107
this . file = scope . file ;
108
108
this . log = scope . log || log ;
109
+ this . createNewScope = scope . createNewScope ;
110
+ this . leaveScope = scope . leaveScope ;
109
111
110
112
} ;
111
113
@@ -502,6 +504,14 @@ Scope.prototype.resolveFunctionExpression = function(node) {
502
504
// Traverses an array of statments.
503
505
Scope . prototype . traverse = function ( ast , returnCB ) {
504
506
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
+
505
515
if ( ast . type == 'BlockStatement' ) {
506
516
( ast . body || [ ast ] ) . forEach ( function ( node ) {
507
517
if ( node . type == 'ExpressionStatement' )
@@ -515,6 +525,11 @@ Scope.prototype.traverse = function(ast, returnCB) {
515
525
// ast is a single statement so resolve it instead
516
526
this . resolveStatement ( ast . expression || ast ) ;
517
527
}
528
+
529
+ if ( flags . verbose )
530
+ ( scope . leaveScope || function ( ) {
531
+ console . log ( 'leaving scope' . yellow ) ;
532
+ } ) ( ) ;
518
533
} ;
519
534
520
535
Scope . prototype . resolvePath = function ( file , cb ) {
You can’t perform that action at this time.
0 commit comments