@@ -82,8 +82,6 @@ struct Processor {
8282
8383 var savePoints : [ SavePoint ] = [ ]
8484
85- var callStack : [ InstructionAddress ] = [ ]
86-
8785 var storedCaptures : Array < _StoredCapture >
8886
8987 var state : State = . inProgress
@@ -146,9 +144,6 @@ extension Processor {
146144 if !self . savePoints. isEmpty {
147145 self . savePoints. removeAll ( keepingCapacity: true )
148146 }
149- if !self . callStack. isEmpty {
150- self . callStack. removeAll ( keepingCapacity: true )
151- }
152147
153148 for idx in storedCaptures. indices {
154149 storedCaptures [ idx] = . init( )
@@ -167,7 +162,6 @@ extension Processor {
167162 _checkInvariants ( )
168163 guard self . controller == Controller ( pc: 0 ) ,
169164 self . savePoints. isEmpty,
170- self . callStack. isEmpty,
171165 self . storedCaptures. allSatisfy ( { $0. range == nil } ) ,
172166 self . state == . inProgress,
173167 self . failureReason == nil
@@ -383,10 +377,9 @@ extension Processor {
383377 state = . fail
384378 return
385379 }
386- let ( pc, pos, stackEnd , capEnds, intRegisters, posRegisters) : (
380+ let ( pc, pos, capEnds, intRegisters, posRegisters) : (
387381 pc: InstructionAddress ,
388382 pos: Position ? ,
389- stackEnd: CallStackAddress ,
390383 captureEnds: [ _StoredCapture ] ,
391384 intRegisters: [ Int ] ,
392385 PositionRegister: [ Input . Index ]
@@ -398,17 +391,15 @@ extension Processor {
398391 // pos instead of removing it
399392 if savePoints [ idx] . isQuantified {
400393 savePoints [ idx] . takePositionFromQuantifiedRange ( input)
401- ( pc, pos, stackEnd , capEnds, intRegisters, posRegisters) = savePoints [ idx] . destructure
394+ ( pc, pos, capEnds, intRegisters, posRegisters) = savePoints [ idx] . destructure
402395 } else {
403- ( pc, pos, stackEnd , capEnds, intRegisters, posRegisters) = savePoints. removeLast ( ) . destructure
396+ ( pc, pos, capEnds, intRegisters, posRegisters) = savePoints. removeLast ( ) . destructure
404397 }
405398
406- assert ( stackEnd. rawValue <= callStack. count)
407399 assert ( capEnds. count == storedCaptures. count)
408400
409401 controller. pc = pc
410402 currentPosition = pos ?? currentPosition
411- callStack. removeLast ( callStack. count - stackEnd. rawValue)
412403 registers. ints = intRegisters
413404 registers. positions = posRegisters
414405
0 commit comments