@@ -69,14 +69,14 @@ export class Walker extends EventEmitter<WalkerEmitter> {
69
69
}
70
70
71
71
public walk ( ) : void {
72
- const {
73
- depth : initialDepth ,
74
- schemaNode : initialSchemaNode ,
75
- path : { length } ,
76
- } = this ;
72
+ const { depth : initialDepth , schemaNode : initialSchemaNode , fragment } = this ;
73
+
74
+ const state = this . dumpInternalWalkerState ( ) ;
75
+
76
+ super . emit ( 'enterFragment' , fragment ) ;
77
77
78
78
for ( const schemaNode of this . processFragment ( ) ) {
79
- super . emit ( 'newNode ' , schemaNode ) ;
79
+ super . emit ( 'enterNode ' , schemaNode ) ;
80
80
81
81
this . processedFragments . set ( schemaNode . fragment , schemaNode ) ;
82
82
@@ -86,6 +86,7 @@ export class Walker extends EventEmitter<WalkerEmitter> {
86
86
const shouldSkipNode = this . hooks . filter ?.( schemaNode ) ;
87
87
88
88
if ( shouldSkipNode === true ) {
89
+ super . emit ( 'skipNode' , schemaNode ) ;
89
90
continue ;
90
91
}
91
92
@@ -102,23 +103,25 @@ export class Walker extends EventEmitter<WalkerEmitter> {
102
103
}
103
104
}
104
105
105
- super . emit ( 'acceptNode ' , schemaNode ) ;
106
+ super . emit ( 'includeNode ' , schemaNode ) ;
106
107
107
108
if ( schemaNode instanceof RegularNode ) {
108
109
this . schemaNode = schemaNode ;
109
110
110
111
if ( this . hooks . stepIn ?.( schemaNode ) !== false ) {
111
- super . emit ( 'enterNode ' , schemaNode ) ;
112
+ super . emit ( 'stepInNode ' , schemaNode ) ;
112
113
this . walkNodeChildren ( ) ;
114
+ super . emit ( 'stepOutNode' , schemaNode ) ;
115
+ } else {
116
+ super . emit ( 'stepOverNode' , schemaNode ) ;
113
117
}
114
118
}
115
119
116
120
super . emit ( 'exitNode' , schemaNode ) ;
117
121
}
118
122
119
- this . path . length = length ;
120
- this . depth = initialDepth ;
121
- this . schemaNode = initialSchemaNode ;
123
+ this . restoreInternalWalkerState ( state ) ;
124
+ super . emit ( 'exitFragment' , fragment ) ;
122
125
}
123
126
124
127
protected dumpInternalWalkerState ( ) : InternalWalkerState {
0 commit comments