Enabled property attribute test, fixed failure.

main
theraven 13 years ago
parent ef5f8b744d
commit aeb0c913b9

@ -4,11 +4,12 @@
set(TESTS
objc_msgSend.m
BlockImpTest.m
PropertyAttributeTest.m
PropertyIntrospectionTest.m
ProtocolCreation.m
RuntimeTest.m
objc_msgSend.m
)
#ExceptionTest.m

@ -1,9 +1,14 @@
#include <stdio.h>
#import <Foundation/NSObject.h>
#import <objc/runtime.h>
#include <string.h>
#include <assert.h>
@interface helloclass : NSObject {
#ifdef __has_attribute
#if __has_attribute(objc_root_class)
__attribute__((objc_root_class))
#endif
#endif
@interface helloclass {
@private int varName;
}
@property (readwrite,assign) int propName;
@ -11,6 +16,7 @@
@implementation helloclass
@synthesize propName = varName;
+ (id)class { return self; }
@end
int main()

@ -400,6 +400,7 @@ PRIVATE const char *constructPropertyAttributes(objc_property_t property,
unsigned char *encoding = malloc(encodingSize);
// Set the leading 0 and the offset of the name
unsigned char *insert = encoding;
BOOL needsComma = NO;
*(insert++) = 0;
*(insert++) = 0;
// Set the type encoding
@ -408,33 +409,39 @@ PRIVATE const char *constructPropertyAttributes(objc_property_t property,
*(insert++) = 'T';
memcpy(insert, typeEncoding, typeSize);
insert += typeSize;
needsComma = YES;
}
// Set the flags
memcpy(insert, flags, i);
insert += i;
if ((property->attributes & OBJC_PR_getter) == OBJC_PR_getter)
{
if (i > 0)
if (needsComma)
{
*(insert++) = ',';
}
i++;
needsComma = YES;
*(insert++) = 'G';
memcpy(insert, property->getter_name, getterLength);
insert += getterLength;
}
if ((property->attributes & OBJC_PR_setter) == OBJC_PR_setter)
{
if (i > 0)
if (needsComma)
{
*(insert++) = ',';
}
i++;
needsComma = YES;
*(insert++) = 'S';
memcpy(insert, property->setter_name, setterLength);
insert += setterLength;
}
*(insert++) = ',';
if (needsComma)
{
*(insert++) = ',';
}
*(insert++) = 'V';
// If the instance variable name is the same as the property name, then we
// use the same string for both, otherwise we write the ivar name in the

Loading…
Cancel
Save