Skip to content

Commit

Permalink
Merge pull request #331 from Ricowere/master
Browse files Browse the repository at this point in the history
Inifinite loop in some while-loops
  • Loading branch information
jasperblues committed Mar 24, 2015
2 parents 1c98abd + c881308 commit c3bbbbc
Show file tree
Hide file tree
Showing 4 changed files with 116 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ - (NSArray *)autoInjectedPropertiesForClass:(Class)clazz
NSMutableArray *injections = nil;
NSSet *allProperties = [TyphoonIntrospectionUtils injectedPropertiesForClass:clazz upToParentClass:[NSObject class]];
for (NSString *propertyName in allProperties) {
TyphoonTypeDescriptor *type = [clazz typhoon_typeForPropertyWithName:propertyName];
TyphoonTypeDescriptor *type = [TyphoonIntrospectionUtils typeForPropertyWithName:propertyName inClass:clazz];

id explicitType = TypeForInjectionFromType(type);
if (!explicitType) {
[NSException raise:NSInternalInconsistencyException format:@"Can't resolve '%@' property in %@ class. Make sure that specified protocol/class exist and linked.", propertyName, clazz];
Expand Down
6 changes: 3 additions & 3 deletions Source/Utils/TyphoonIntrospectionUtils.m
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ + (NSSet *)injectedPropertiesForClass:(Class)clazz upToParentClass:(Class)parent
NSString *injectedObjectClassName = NSStringFromClass([TyphoonInjectedObject class]);
NSString *injectedProtolName = NSStringFromProtocol(@protocol(TyphoonInjectedProtocol));

while (clazz != parent) {
while (clazz && clazz != parent) {
unsigned int count = 0;
objc_property_t *properties = class_copyPropertyList(clazz, &count);

Expand Down Expand Up @@ -177,7 +177,7 @@ + (NSSet *)propertiesForClass:(Class)clazz upToParentClass:(Class)parent

NSMutableSet *propertyNames = [[NSMutableSet alloc] init];

while (clazz != parent) {
while (clazz && clazz != parent) {
unsigned int count = 0;
objc_property_t *properties = class_copyPropertyList(clazz, &count);

Expand All @@ -202,7 +202,7 @@ + (NSSet *)methodsForClass:(Class)clazz upToParentClass:(Class)parent
{
NSMutableSet *methodSelectors = [[NSMutableSet alloc] init];

while (clazz != parent) {
while (clazz && clazz != parent) {
unsigned int methodCount;
Method *methodList = class_copyMethodList(clazz, &methodCount);
for (unsigned int i = 0; i < methodCount; i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,20 @@
ReferencedContainer = "container:Typhoon.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "90ABC4CE1A36BA53008D8162"
BuildableName = "TyphoonFrameworkSwiftExampleTests.xctest"
BlueprintName = "TyphoonFrameworkSwiftExampleTests"
ReferencedContainer = "container:Typhoon.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
Expand All @@ -28,6 +42,16 @@
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "90ABC4CE1A36BA53008D8162"
BuildableName = "TyphoonFrameworkSwiftExampleTests.xctest"
BlueprintName = "TyphoonFrameworkSwiftExampleTests"
ReferencedContainer = "container:Typhoon.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
Expand All @@ -48,7 +72,8 @@
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
allowLocationSimulation = "YES">
<BuildableProductRunnable>
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "90ABC4BA1A36BA53008D8162"
Expand All @@ -66,7 +91,8 @@
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
debugDocumentVersioning = "YES">
<BuildableProductRunnable>
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "90ABC4BA1A36BA53008D8162"
Expand Down
87 changes: 83 additions & 4 deletions Typhoon.xcodeproj/xcshareddata/xcschemes/TyphoonSwift.xcscheme
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
version = "1.3">
<BuildAction>
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForRunning = "YES">
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "90ABC4BA1A36BA53008D8162"
Expand All @@ -13,12 +19,60 @@
ReferencedContainer = "container:Typhoon.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "90ABC4CE1A36BA53008D8162"
BuildableName = "TyphoonFrameworkSwiftExampleTests.xctest"
BlueprintName = "TyphoonFrameworkSwiftExampleTests"
ReferencedContainer = "container:Typhoon.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "90ABC4CE1A36BA53008D8162"
BuildableName = "TyphoonFrameworkSwiftExampleTests.xctest"
BlueprintName = "TyphoonFrameworkSwiftExampleTests"
ReferencedContainer = "container:Typhoon.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "90ABC4BA1A36BA53008D8162"
BuildableName = "TyphoonFrameworkSwiftExample.app"
BlueprintName = "TyphoonFrameworkSwiftExample"
ReferencedContainer = "container:Typhoon.xcodeproj">
</BuildableReference>
</MacroExpansion>
</TestAction>
<LaunchAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug">
<BuildableProductRunnable>
buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "90ABC4BA1A36BA53008D8162"
Expand All @@ -27,5 +81,30 @@
ReferencedContainer = "container:Typhoon.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "90ABC4BA1A36BA53008D8162"
BuildableName = "TyphoonFrameworkSwiftExample.app"
BlueprintName = "TyphoonFrameworkSwiftExample"
ReferencedContainer = "container:Typhoon.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

0 comments on commit c3bbbbc

Please sign in to comment.