diff --git a/core/vm.cpp b/core/vm.cpp index dedfb5814..eee91051f 100644 --- a/core/vm.cpp +++ b/core/vm.cpp @@ -600,21 +600,17 @@ class Interpreter { /** Auxiliary function. */ - IdHideMap objectFields(const HeapObject *obj_, - unsigned &counter, unsigned skip, - bool manifesting) + IdHideMap objectFieldsAux(const HeapObject *obj_) { IdHideMap r; if (auto *obj = dynamic_cast(obj_)) { - counter++; - if (counter <= skip) return r; for (const auto &f : obj->fields) { - r[f.first] = !manifesting ? ObjectField::VISIBLE : f.second.hide; + r[f.first] = f.second.hide; } } else if (auto *obj = dynamic_cast(obj_)) { - r = objectFields(obj->right, counter, skip, manifesting); - for (const auto &pair : objectFields(obj->left, counter, skip, manifesting)) { + r = objectFieldsAux(obj->right); + for (const auto &pair : objectFieldsAux(obj->left)) { auto it = r.find(pair.first); if (it == r.end()) { // First time it is seen @@ -626,8 +622,6 @@ class Interpreter { } } else if (auto *obj = dynamic_cast(obj_)) { - counter++; - if (counter <= skip) return r; for (const auto &f : obj->compValues) r[f.first] = ObjectField::VISIBLE; } @@ -638,10 +632,9 @@ class Interpreter { */ std::set objectFields(const HeapObject *obj_, bool manifesting) { - unsigned counter = 0; std::set r; - for (const auto &pair : objectFields(obj_, counter, 0, manifesting)) { - if (pair.second != ObjectField::HIDDEN) r.insert(pair.first); + for (const auto &pair : objectFieldsAux(obj_)) { + if (!manifesting || pair.second != ObjectField::HIDDEN) r.insert(pair.first); } return r; }