@@ -8,6 +8,7 @@ internal class ExpressionState
88 {
99 public VisitorCache < ScanStepItem > ScanStepCache ;
1010 public VisitorCache < ComputedStepItem > ComputedStepCache ;
11+ public VisitorCache < OperationStepItem > OperationStepCache ;
1112
1213 public string WorkingText { get ; set ; } = string . Empty ;
1314 public readonly StringBuilder Buffer ;
@@ -31,6 +32,7 @@ public ExpressionState(Sanitized sanitized, ExpressionOptions options)
3132
3233 ScanStepCache = new ( _operationCount * 3 ) ;
3334 ComputedStepCache = new ( _operationCount * 3 ) ;
35+ OperationStepCache = new ( _operationCount ) ;
3436
3537 for ( int i = 0 ; i < sanitized . ConsumedPlaceholderCacheSlots ; i ++ )
3638 {
@@ -46,8 +48,9 @@ public ExpressionState(Sanitized sanitized, ExpressionOptions options)
4648 public ExpressionState ( ExpressionOptions options , int operationCount , int preAllocation )
4749 {
4850 Buffer = new StringBuilder ( preAllocation ) ;
49- ScanStepCache = new ( _operationCount * 3 ) ;
50- ComputedStepCache = new ( _operationCount * 3 ) ;
51+ ScanStepCache = new ( operationCount * 3 ) ;
52+ ComputedStepCache = new ( operationCount * 3 ) ;
53+ OperationStepCache = new ( operationCount ) ;
5154 _options = options ;
5255 }
5356
@@ -110,6 +113,7 @@ public void HydrateTemplateCache(int expressionHash)
110113 {
111114 ComputedStepCache . CopyTo ( entry . State . ComputedStepCache ) ;
112115 ScanStepCache . CopyTo ( entry . State . ScanStepCache ) ;
116+ OperationStepCache . CopyTo ( entry . State . OperationStepCache ) ;
113117 }
114118 _isTemplateCacheHydrated = true ;
115119 }
@@ -123,6 +127,7 @@ public void Reset(Sanitized sanitized)
123127 _nextPlaceholderCacheSlot = sanitized . ConsumedPlaceholderCacheSlots ;
124128 ComputedStepCache . Reset ( ) ;
125129 ScanStepCache . Reset ( ) ;
130+ OperationStepCache . Reset ( ) ;
126131 }
127132
128133 public ExpressionState Clone ( Sanitized sanitized )
@@ -133,13 +138,12 @@ public ExpressionState Clone(Sanitized sanitized)
133138 _operationCount = _operationCount ,
134139 _nextPlaceholderCacheSlot = _nextPlaceholderCacheSlot ,
135140 _placeholderCache = new PlaceholderCacheItem [ _placeholderCache . Length ] ,
136- _isTemplateCacheHydrated = _isTemplateCacheHydrated ,
137- ComputedStepCache = new ( _operationCount * 3 ) ,
138- ScanStepCache = new ( _operationCount * 3 ) ,
141+ _isTemplateCacheHydrated = _isTemplateCacheHydrated
139142 } ;
140143
141144 ComputedStepCache . CopyTo ( clone . ComputedStepCache ) ;
142145 ScanStepCache . CopyTo ( clone . ScanStepCache ) ;
146+ OperationStepCache . CopyTo ( clone . OperationStepCache ) ;
143147
144148 for ( int i = 0 ; i < sanitized . ConsumedPlaceholderCacheSlots ; i ++ )
145149 {
0 commit comments