@@ -565,33 +565,28 @@ class Interpreter {
565
565
* with the given field. Call with offset initially set to 0.
566
566
*
567
567
* \param f The field we're looking for.
568
- * \param curr The root object.
569
568
* \param start_from Step over this many leaves first.
570
569
* \param counter Return the level of "super" that contained the field.
571
- * \param self Return the new root.
572
570
* \returns The first object with the field, or nullptr if it could not be found.
573
571
*/
574
- HeapLeafObject *findObject (const Identifier *f, HeapObject *root, HeapObject *curr,
575
- unsigned start_from, unsigned &counter,
576
- HeapObject *&self)
572
+ HeapLeafObject *findObject (const Identifier *f, HeapObject *curr,
573
+ unsigned start_from, unsigned &counter)
577
574
{
578
575
if (auto *ext = dynamic_cast <HeapExtendedObject*>(curr)) {
579
- auto *r = findObject (f, root, ext->right , start_from, counter, self );
576
+ auto *r = findObject (f, ext->right , start_from, counter);
580
577
if (r) return r;
581
- auto *l = findObject (f, root, ext->left , start_from, counter, self );
578
+ auto *l = findObject (f, ext->left , start_from, counter);
582
579
if (l) return l;
583
580
} else {
584
581
if (counter >= start_from) {
585
582
if (auto *simp = dynamic_cast <HeapSimpleObject*>(curr)) {
586
583
auto it = simp->fields .find (f);
587
584
if (it != simp->fields .end ()) {
588
- self = root;
589
585
return simp;
590
586
}
591
587
} else if (auto *comp = dynamic_cast <HeapComprehensionObject*>(curr)) {
592
588
auto it = comp->compValues .find (f);
593
589
if (it != comp->compValues .end ()) {
594
- self = root;
595
590
return comp;
596
591
}
597
592
}
@@ -847,8 +842,8 @@ class Interpreter {
847
842
const Identifier *f, unsigned offset)
848
843
{
849
844
unsigned found_at = 0 ;
850
- HeapObject *self = nullptr ;
851
- HeapLeafObject *found = findObject (f, obj, obj, offset, found_at, self );
845
+ HeapObject *self = obj ;
846
+ HeapLeafObject *found = findObject (f, obj, offset, found_at);
852
847
if (found == nullptr ) {
853
848
throw makeError (loc, " Field does not exist: " + encode_utf8 (f->name ));
854
849
}
0 commit comments