-
Notifications
You must be signed in to change notification settings - Fork 117
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor ClassLike and add ClassLikeDef
This change refactors definition.json to make `ClassLike` a non-recursive type. Before the introduction of class-based dependency tracking, an api of a nested class has been stored as a member of the enclosing class so a class could have other class as a member. This was expressed by the fact that `ClassLike` was recursive: its Structure had a collection of `Definition` to represents the members and `ClassLike` was a subtype of `Definition`. With introduction of class-based dependency tracking, each class has been extracted and stored separately. The inner class would still be stored as a member of outer class but members of inner classes were skipped. An empty inner class was stored just to mark the fact that there's a member with a given name which is important for name hashing correctness when there's no dependency on a class directly but a rename could introduce one. Storing an empty class was a hack and this commit fixes the type hierarchy by introducing the following changes: - introduce ClassDefinition that is a subtype of Definition; all members of a class are subtypes of ClassDefinition (ClassLike is not a subtype of ClassDefinition) - change Structure to refer to ClassDefinition instead of Definition for members - move ClassLike higher up in type hierarchy so its a direct subtype of Definition - introduce ClassLikeDef which represents an inner class as a member of the outer class; ClassLikeDef carries only information about class declaration itself but not about its members and that is enforced statically NameHashing has been simplified because it doesn't have to keep track of the entire path for definitions it hashes. Hashes of names are tracked individually per class so location is simply name of the class and it's type (we want to distinguish between objects and classes). NameHashingSpecification has been refactored to not rely on nested classes for testing the desired scenarios. The semantics of tests has been preserved even if a different API structure is used in tests.
- Loading branch information
1 parent
f3a4608
commit 1a696ed
Showing
14 changed files
with
237 additions
and
252 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.