@@ -746,6 +746,57 @@ EidosValue_SP EidosClass::ExecuteMethod_size_length(EidosGlobalStringID p_method
746746}
747747
748748
749+ #ifdef EIDOS_GUI
750+ // We provide some support here for EidosTypeInterpreter to make code completion work with dynamic properties
751+
752+ void EidosClass::ClearDynamicSignatures (void )
753+ {
754+ std::vector<EidosClass *> classes = EidosClass::RegisteredClasses (/* p_builtin */ true , /* p_context */ true );
755+
756+ for (EidosClass *one_class : classes)
757+ one_class->dynamic_property_signatures_ .clear ();
758+ }
759+
760+ void EidosClass::AddSignatureForProperty_TYPE_INTERPRETER (EidosPropertySignature_CSP p_property_signature)
761+ {
762+ // if a dynamic property already exists with the given name, we assume it is the same, and just return
763+ for (EidosPropertySignature_CSP dynamic_property : dynamic_property_signatures_)
764+ if (dynamic_property->property_id_ == p_property_signature->property_id_ )
765+ return ;
766+
767+ dynamic_property_signatures_.push_back (p_property_signature);
768+ }
769+
770+ // This calls Properties() to get the built-in properties, and then adds the dynamic ones
771+ std::vector<EidosPropertySignature_CSP> EidosClass::Properties_TYPE_INTERPRETER (void ) const
772+ {
773+ std::vector<EidosPropertySignature_CSP> properties = *Properties (); // make a local copy for ourselves to modify
774+
775+ for (EidosPropertySignature_CSP dynamic_property : dynamic_property_signatures_)
776+ properties.push_back (dynamic_property);
777+
778+ std::sort (properties.begin (), properties.end (), CompareEidosPropertySignatures);
779+
780+ return properties;
781+ }
782+
783+ // This calls SignatureForProperty(), and then checks the dynamic ones if that failed
784+ const EidosPropertySignature *EidosClass::SignatureForProperty_TYPE_INTERPRETER (EidosGlobalStringID p_property_id) const
785+ {
786+ const EidosPropertySignature *signature = SignatureForProperty (p_property_id);
787+
788+ if (signature)
789+ return signature;
790+
791+ for (EidosPropertySignature_CSP dynamic_property : dynamic_property_signatures_)
792+ if (dynamic_property->property_id_ == p_property_id)
793+ return dynamic_property.get ();
794+
795+ return nullptr ;
796+ }
797+
798+ #endif // EIDOS_GUI
799+
749800
750801
751802
0 commit comments