jasperblues/Typhoon — pull request #67 by cesteban (2013-09-05 18:38:40+00:00)
Title: Circular prototypes

This is the fix I was talking about in https://github.com/jasperblues/Typhoon/issues/57. The only important change is that registration in _currentlyResolvingReferences happens just after allocation of the instance. This solves the problem I was having with initializer injection and circular dependencies. Please, let me know your opinion.

I also added a very simple test that used to make Typhoon to fall in this well-known infinite loop. With this fix the test passes.

The other changes are basically reorganization of method buildInstanceWithDefinition:. Its multiple responsibilities (allocate instance, mark as currently resolving, initialize, resolve properties, mark as already resolved) are split in different methods now. I also renamed some methods to better reflect their responsibilities. This part is more readable now IMHO.

All feedback is greatly appreciated.