@@ -168,11 +168,17 @@ var _ MemberAccessibleContext = &Interpreter{}
168
168
169
169
type FunctionCreationContext interface {
170
170
StaticTypeAndReferenceContext
171
- GetCompositeValueFunctions ( v * CompositeValue , locationRange LocationRange ) * FunctionOrderedMap
171
+ CompositeFunctionContext
172
172
}
173
173
174
174
var _ FunctionCreationContext = & Interpreter {}
175
175
176
+ type CompositeFunctionContext interface {
177
+ GetCompositeValueFunctions (v * CompositeValue , locationRange LocationRange ) * FunctionOrderedMap
178
+ }
179
+
180
+ var _ CompositeFunctionContext = & Interpreter {}
181
+
176
182
type StaticTypeAndReferenceContext interface {
177
183
common.MemoryGauge
178
184
ValueStaticTypeContext
@@ -204,6 +210,12 @@ type ResourceDestructionHandler interface {
204
210
valueID atree.ValueID ,
205
211
locationRange LocationRange ,
206
212
)
213
+
214
+ WithResourceDestruction (
215
+ valueID atree.ValueID ,
216
+ locationRange LocationRange ,
217
+ f func (),
218
+ )
207
219
}
208
220
209
221
var _ ResourceDestructionHandler = & Interpreter {}
@@ -216,6 +228,29 @@ type CapConReferenceValueContext interface {
216
228
217
229
var _ CapConReferenceValueContext = & Interpreter {}
218
230
231
+ type ResourceDestructionContext interface {
232
+ ValueWalkContext
233
+ ResourceDestructionHandler
234
+ CompositeFunctionContext
235
+ EventContext
236
+
237
+ GetResourceDestructionContextForLocation (location common.Location ) ResourceDestructionContext
238
+ }
239
+
240
+ var _ ResourceDestructionContext = & Interpreter {}
241
+
242
+ type ValueWalkContext interface {
243
+ ContainerMutationContext
244
+ }
245
+
246
+ var _ ValueWalkContext = & Interpreter {}
247
+
248
+ type EventContext interface {
249
+ EmitEvent (event * CompositeValue , eventType * sema.CompositeType , locationRange LocationRange )
250
+ }
251
+
252
+ var _ EventContext = & Interpreter {}
253
+
219
254
// NoOpStringContext is the ValueStringContext implementation used in Value.RecursiveString method.
220
255
// Since Value.RecursiveString is a non-mutating operation, it should only need the no-op memory metering
221
256
// and a WithMutationPrevention implementation.
@@ -308,6 +343,10 @@ func (ctx NoOpStringContext) ReportArrayValueTransferTrace(_ string, _ int, _ ti
308
343
panic (errors .NewUnreachableError ())
309
344
}
310
345
346
+ func (ctx NoOpStringContext ) ReportArrayValueDestroyTrace (_ string , _ int , _ time.Duration ) {
347
+ panic (errors .NewUnreachableError ())
348
+ }
349
+
311
350
func (ctx NoOpStringContext ) ReportArrayValueConstructTrace (_ string , _ int , _ time.Duration ) {
312
351
panic (errors .NewUnreachableError ())
313
352
}
@@ -316,6 +355,10 @@ func (ctx NoOpStringContext) ReportDictionaryValueTransferTrace(_ string, _ int,
316
355
panic (errors .NewUnreachableError ())
317
356
}
318
357
358
+ func (ctx NoOpStringContext ) ReportDictionaryValueDestroyTrace (_ string , _ int , _ time.Duration ) {
359
+ panic (errors .NewUnreachableError ())
360
+ }
361
+
319
362
func (ctx NoOpStringContext ) ReportDictionaryValueDeepRemoveTrace (_ string , _ int , _ time.Duration ) {
320
363
panic (errors .NewUnreachableError ())
321
364
}
@@ -340,6 +383,10 @@ func (ctx NoOpStringContext) ReportCompositeValueSetMemberTrace(_ string, _ stri
340
383
panic (errors .NewUnreachableError ())
341
384
}
342
385
386
+ func (ctx NoOpStringContext ) ReportCompositeValueDestroyTrace (_ string , _ string , _ string , _ time.Duration ) {
387
+ panic (errors .NewUnreachableError ())
388
+ }
389
+
343
390
func (ctx NoOpStringContext ) ReportCompositeValueGetMemberTrace (_ string , _ string , _ string , _ string , _ time.Duration ) {
344
391
panic (errors .NewUnreachableError ())
345
392
}
0 commit comments