File tree Expand file tree Collapse file tree 2 files changed +33
-1
lines changed Expand file tree Collapse file tree 2 files changed +33
-1
lines changed Original file line number Diff line number Diff line change @@ -645,7 +645,8 @@ namespace das {
645
645
TypeInfoAnnotation (ModuleLibrary & ml) : ManagedTypeInfoAnnotation (" TypeInfo" , ml) {
646
646
addField<DAS_BIND_MANAGED_FIELD (type)>(" _type" ," type" );
647
647
addField<DAS_BIND_MANAGED_FIELD (dim)>(" dim" );
648
- addField<DAS_BIND_MANAGED_FIELD (annotation_or_name)>(" annotation_or_name" );
648
+ // addField<DAS_BIND_MANAGED_FIELD(annotation_or_name)>("annotation_or_name");
649
+ addProperty<DAS_BIND_MANAGED_PROP (getAnnotation)>(" annotation_or_name" , " getAnnotation" );
649
650
}
650
651
};
651
652
Original file line number Diff line number Diff line change @@ -145,6 +145,37 @@ def public class_info(cl) : StructInfo const? {
145
145
}
146
146
}
147
147
148
+ def public type_info (cl) : TypeInfo const? {
149
+ static_if (typeinfo is_pointer (cl )) {
150
+ if (cl == null ) {
151
+ return null
152
+ }
153
+ static_if (typeinfo is_class (* cl )) {
154
+ unsafe {
155
+ return (reinterpret < TypeInfo const ?> ((* cl ).__rtti ))
156
+ }
157
+ } else {
158
+ concept_assert (false , "not a pointer to a class" )
159
+ return null
160
+ }
161
+ } static_elif (typeinfo is_class (cl )) {
162
+ unsafe {
163
+ return reinterpret < TypeInfo const ?> (cl .__rtti )
164
+ }
165
+ } static_elif (typeinfo is_lambda (cl )) {
166
+ unsafe {
167
+ var l = reinterpret < int8 ?? > addr (cl )
168
+ if (l == null ) {
169
+ return null
170
+ }
171
+ return reinterpret < TypeInfo const ?? > (l [0 ] - 16 )
172
+ }
173
+ } else {
174
+ concept_assert (false , "this type does not have class info. its not a class or a lambda with options rtti" )
175
+ return null
176
+ }
177
+ }
178
+
148
179
[generic ]
149
180
def type_info (vinfo : LocalVariableInfo) : TypeInfo const? {
150
181
unsafe {
You can’t perform that action at this time.
0 commit comments