Skip to content

Commit 1ffd8ce

Browse files
committed
fix an autocompletion bug with dynamic properties
1 parent 7ba55be commit 1ffd8ce

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

eidos/eidos_class_Object.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -807,6 +807,20 @@ std::vector<EidosPropertySignature_CSP> EidosClass::Properties_TYPE_INTERPRETER(
807807

808808
std::sort(properties.begin(), properties.end(), CompareEidosPropertySignatures);
809809

810+
// We got properties from two places: the built-in properties of the class, and dynamic property
811+
// signatures. Dynamic properties actually end up in both places sometimes: they get added to the
812+
// class itself (if execution has proceeded to the point where that happens), AND they get added
813+
// to the list of dynamic properties (by the type interpreter, which can do this even if execution
814+
// has not reached the point where the property actually exists yet). This is good -- it means
815+
// that we know about the signature in two different ways that are valid at different places and
816+
// times. But it also means that we can contain duplicates at this point, so we need to unique.
817+
// The uniquing needs to be done by name; the duplicates are different signature objects.
818+
auto unique_end_iter = std::unique(properties.begin(), properties.end(),
819+
[](const EidosPropertySignature_CSP& a, const EidosPropertySignature_CSP& b) {
820+
return a->property_name_ == b->property_name_;
821+
});
822+
properties.resize(std::distance(properties.begin(), unique_end_iter));
823+
810824
return properties;
811825
}
812826

0 commit comments

Comments
 (0)