@@ -295,15 +295,9 @@ bool MCResolvedTypeInfoConforms(const MCResolvedTypeInfo& source, const MCResolv
295295 return false ;
296296 }
297297
298- // If the source is of record type, then the target must be the same type or
299- // one of the source's super types.
298+ // If the source is of record type, then the target must be the same type.
300299 if (MCTypeInfoIsRecord (source . type))
301300 {
302- // Now check to see if the target is one of the source's supertypes.
303- for (MCTypeInfoRef t_supertype = source . type; t_supertype != kMCNullTypeInfo ; t_supertype = __MCTypeInfoResolve (t_supertype) -> record . base)
304- if (target . named_type == t_supertype)
305- return true ;
306-
307301 return false ;
308302 }
309303
@@ -688,19 +682,11 @@ void *MCForeignTypeInfoGetLayoutType(MCTypeInfoRef unresolved_self)
688682// //////////////////////////////////////////////////////////////////////////////
689683
690684MC_DLLEXPORT_DEF
691- bool MCRecordTypeInfoCreate (const MCRecordTypeFieldInfo *p_fields, index_t p_field_count, MCTypeInfoRef p_base, MCTypeInfoRef & r_typeinfo)
685+ bool MCRecordTypeInfoCreate (const MCRecordTypeFieldInfo *p_fields, index_t p_field_count, MCTypeInfoRef& r_typeinfo)
692686
693687{
694688 MCAssert (nil != p_fields || p_field_count == 0 );
695689
696- MCTypeInfoRef t_resolved_base;
697- t_resolved_base = kMCNullTypeInfo ;
698- if (p_base != kMCNullTypeInfo )
699- {
700- t_resolved_base = __MCTypeInfoResolve (p_base);
701- MCAssert (MCTypeInfoIsRecord (t_resolved_base));
702- }
703-
704690 /* If the p_field_count < 0 then the p_fields are expected to be
705691 * terminated by a custodian with name = nil. */
706692 if (p_field_count < 0 )
@@ -733,7 +719,6 @@ bool MCRecordTypeInfoCreate(const MCRecordTypeFieldInfo *p_fields, index_t p_fie
733719 self -> record . fields[i] . type = MCValueRetain (p_fields[i] . type);
734720 }
735721 self -> record . field_count = p_field_count;
736- self -> record . base = MCValueRetain (t_resolved_base);
737722
738723 if (MCValueInterAndRelease (self, r_typeinfo))
739724 return true ;
@@ -743,15 +728,6 @@ bool MCRecordTypeInfoCreate(const MCRecordTypeFieldInfo *p_fields, index_t p_fie
743728 return false ;
744729}
745730
746- MC_DLLEXPORT_DEF
747- MCTypeInfoRef MCRecordTypeInfoGetBaseType (MCTypeInfoRef unresolved_self)
748- {
749- MCTypeInfoRef self;
750- self = __MCTypeInfoResolve (unresolved_self);
751- MCAssert (MCTypeInfoIsRecord (self));
752- return self -> record . base;
753- }
754-
755731MC_DLLEXPORT_DEF
756732uindex_t MCRecordTypeInfoGetFieldCount (MCTypeInfoRef unresolved_self)
757733{
@@ -765,15 +741,7 @@ uindex_t MCRecordTypeInfoGetFieldCount(MCTypeInfoRef unresolved_self)
765741uindex_t
766742__MCRecordTypeInfoGetFieldCount (MCTypeInfoRef self)
767743{
768- /* Sum field counts of all base record types */
769- uindex_t t_field_count;
770- t_field_count = 0 ;
771- while (self != kMCNullTypeInfo ) {
772- t_field_count += self -> record . field_count;
773- self = MCRecordTypeInfoGetBaseType (self);
774- }
775-
776- return t_field_count;
744+ return self->record .field_count ;
777745}
778746
779747MC_DLLEXPORT_DEF
@@ -784,12 +752,8 @@ MCNameRef MCRecordTypeInfoGetFieldName(MCTypeInfoRef unresolved_self, uindex_t p
784752
785753 MCAssert ((self -> flags & kMCTypeInfoTypeCodeMask ) == kMCValueTypeCodeRecord );
786754
787- MCTypeInfoRef t_base_type;
788- uindex_t t_base_index;
789- __MCRecordTypeInfoGetBaseTypeForField (self, p_index,
790- t_base_type, t_base_index);
791-
792- return t_base_type -> record . fields[t_base_index] . name;
755+ MCAssert (p_index < self->record .field_count );
756+ return self -> record . fields[p_index] . name;
793757}
794758
795759MC_DLLEXPORT_DEF
@@ -800,48 +764,8 @@ MCTypeInfoRef MCRecordTypeInfoGetFieldType(MCTypeInfoRef unresolved_self, uindex
800764
801765 MCAssert ((self -> flags & kMCTypeInfoTypeCodeMask ) == kMCValueTypeCodeRecord );
802766
803- MCTypeInfoRef t_base_type;
804- uindex_t t_base_index;
805- __MCRecordTypeInfoGetBaseTypeForField (self, p_index,
806- t_base_type, t_base_index);
807-
808- return t_base_type -> record . fields[t_base_index] . type;
809- }
810-
811- MC_DLLEXPORT_DEF bool
812- MCRecordTypeInfoIsDerivedFrom (MCTypeInfoRef self,
813- MCTypeInfoRef other)
814- {
815- MCAssert (MCTypeInfoIsRecord (self));
816- MCAssert (MCTypeInfoIsRecord (other));
817- return MCTypeInfoConforms (self, other);
818- }
819-
820- // //////////////////////////////////////////////////////////////////////////////
821-
822- void
823- __MCRecordTypeInfoGetBaseTypeForField (__MCTypeInfo *self,
824- uindex_t p_index,
825- __MCTypeInfo *& r_base,
826- uindex_t & r_base_index)
827- {
828- uindex_t t_total_field_count;
829- t_total_field_count = MCRecordTypeInfoGetFieldCount (self);
830- MCAssert (t_total_field_count > p_index);
831-
832- /* Search for the base record type where the requested field is
833- * defined. */
834- uindex_t t_base_field_count;
835- t_base_field_count = t_total_field_count;
836- while (t_base_field_count > p_index)
837- {
838- MCAssert (self != kMCNullTypeInfo );
839- t_base_field_count -= self -> record . field_count;
840- self = MCRecordTypeInfoGetBaseType (self);
841- }
842-
843- r_base = self;
844- r_base_index = p_index - t_base_field_count;
767+ MCAssert (p_index < self->record .field_count );
768+ return self -> record . fields[p_index] . type;
845769}
846770
847771// //////////////////////////////////////////////////////////////////////////////
@@ -1242,7 +1166,6 @@ void __MCTypeInfoDestroy(__MCTypeInfo *self)
12421166 }
12431167 else if (t_ext_typecode == kMCValueTypeCodeRecord )
12441168 {
1245- MCValueRelease (self -> record . base);
12461169 for (uindex_t i = 0 ; i < self -> record . field_count; i++)
12471170 {
12481171 MCValueRelease (self -> record . fields[i] . name);
@@ -1318,7 +1241,6 @@ hash_t __MCTypeInfoHash(__MCTypeInfo *self)
13181241 }
13191242 else if (t_code == kMCValueTypeCodeRecord )
13201243 {
1321- t_hash = MCHashBytesStream (t_hash, &self -> record . base, sizeof (self -> record . base));
13221244 t_hash = MCHashBytesStream (t_hash, &self -> record . field_count, sizeof (self -> record . field_count));
13231245 t_hash = MCHashBytesStream (t_hash, self -> record . fields, sizeof (MCRecordTypeFieldInfo) * self -> record . field_count);
13241246 }
@@ -1369,16 +1291,7 @@ bool __MCTypeInfoIsEqualTo(__MCTypeInfo *self, __MCTypeInfo *other_self)
13691291
13701292 if (t_code == kMCValueTypeCodeRecord )
13711293 {
1372- if (self -> record . base != other_self -> record . base)
1373- return false ;
1374-
1375- if (self -> record . field_count != other_self -> record . field_count)
1376- return false ;
1377-
1378- for (uindex_t i = 0 ; i < self -> record . field_count; i++)
1379- if (!MCNameIsEqualTo (self -> record . fields[i] . name, other_self -> record . fields[i] . name) ||
1380- self -> record . fields[i] . type != other_self -> record . fields[i] . type)
1381- return false ;
1294+ return self == other_self;
13821295 }
13831296 else if (t_code == kMCValueTypeCodeHandler )
13841297 {
0 commit comments