@@ -112,13 +112,27 @@ struct StaticFieldInfo
112112 mlir_ts::AccessLevel accessLevel;
113113};
114114
115+ // what we know about a registered function; deliberately not the FuncOp itself -
116+ // discovery-pass ops are erased with the discovery module, so cached op handles dangle.
117+ // Resolve a live op through theModule.lookupSymbol when one is actually needed.
118+ struct FunctionEntry
119+ {
120+ std::string name;
121+ mlir_ts::FunctionType funcType;
122+
123+ explicit operator bool () const
124+ {
125+ return static_cast <bool >(funcType);
126+ }
127+ };
128+
115129struct MethodInfo
116130{
117- // TODO: convert to attribute as fields
131+ // TODO: convert to attribute as fields
118132 std::string name;
119133 mlir_ts::FunctionType funcType;
120- // TODO: remove using it, we do not need it, we need actual name of function not function itself
121- mlir_ts::FuncOp funcOp ;
134+ // symbol name of the function implementing the method (see FunctionEntry note)
135+ std::string funcName ;
122136 bool isStatic;
123137 bool isVirtual;
124138 bool isAbstract;
@@ -156,8 +170,8 @@ struct VirtualMethodOrInterfaceVTableInfo
156170struct AccessorInfo
157171{
158172 std::string name;
159- mlir_ts::FuncOp get;
160- mlir_ts::FuncOp set;
173+ FunctionEntry get;
174+ FunctionEntry set;
161175 bool isStatic;
162176 bool isVirtual;
163177 bool isAbstract;
@@ -168,8 +182,8 @@ struct AccessorInfo
168182struct IndexInfo
169183{
170184 mlir_ts::FunctionType indexSignature;
171- mlir_ts::FuncOp get;
172- mlir_ts::FuncOp set;
185+ FunctionEntry get;
186+ FunctionEntry set;
173187 mlir_ts::AccessLevel getAccessLevel;
174188 mlir_ts::AccessLevel setAccessLevel;
175189};
@@ -801,9 +815,11 @@ struct ClassInfo
801815 auto it = methodSlots.find (method.name );
802816 if (it != methodSlots.end ())
803817 {
804- // found method - override the inherited slot
818+ // found method - override the inherited slot (name and type together:
819+ // the overriding function's type must win over the inherited one)
805820 auto index = it->second ;
806- vtable[index].methodInfo .funcOp = method.funcOp ;
821+ vtable[index].methodInfo .funcName = method.funcName ;
822+ vtable[index].methodInfo .funcType = method.funcType ;
807823 method.virtualIndex = index;
808824 method.isVirtual = true ;
809825 vtable[index].methodInfo .isAbstract = method.isAbstract ;
@@ -985,20 +1001,6 @@ struct GenericClassInfo
9851001 }
9861002};
9871003
988- // what we know about a registered function; deliberately not the FuncOp itself -
989- // discovery-pass ops are erased with the discovery module, so cached op handles dangle.
990- // Resolve a live op through theModule.lookupSymbol when one is actually needed.
991- struct FunctionEntry
992- {
993- std::string name;
994- mlir_ts::FunctionType funcType;
995-
996- explicit operator bool () const
997- {
998- return static_cast <bool >(funcType);
999- }
1000- };
1001-
10021004struct NamespaceInfo
10031005{
10041006 public:
0 commit comments