Skip to content

Commit

Permalink
Refactor: merge SubtypeResolvedType and InterfaceResolvedType
Browse files Browse the repository at this point in the history
  • Loading branch information
kindlich committed Sep 2, 2024
1 parent 4be6226 commit 3091552
Show file tree
Hide file tree
Showing 7 changed files with 232 additions and 343 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,7 @@ public ResolvingType resolve(TypeID[] typeArguments) {

if (superType != null) {
TypeID instancedSuperType = mapper.map(superType);
ResolvingType superResolved = instancedSuperType.resolve();
resolved = new SubclassResolvingType(superResolved, resolved, superType);
resolved = new SubclassResolvingType(resolved, instancedSuperType);
}

return InterfaceResolvingType.of(resolved, interfaces);
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public ResolvedType withExpansions(List<ExpansionSymbol> expansions) {
.flatMap(iface -> expansions.stream().map(expansion -> expansion.resolve(iface)).filter(Optional::isPresent).map(Optional::get))
.collect(Collectors.toList());

return InterfaceResolvedType.of(
return SubtypeResolvedType.ofImplementation(
ExpandedResolvedType.of(
baseType.withExpansions(expansions),
interfaceExpansions),
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,10 @@
public class SubclassResolvingType implements ResolvingType {
private final ResolvingType superclass;
private final ResolvingType base;
private final TypeID supertype;

public SubclassResolvingType(ResolvingType superclass, ResolvingType base, TypeID supertype) {
this.superclass = superclass;
public SubclassResolvingType(ResolvingType base, TypeID superclass) {
this.superclass = superclass.resolve();
this.base = base;
this.supertype = supertype;
}

@Override
Expand All @@ -25,6 +23,6 @@ public TypeID getType() {

@Override
public ResolvedType withExpansions(List<ExpansionSymbol> expansions) {
return new SubclassResolvedType(superclass.withExpansions(expansions), base.withExpansions(expansions), supertype);
return SubtypeResolvedType.ofChildClass(base.withExpansions(expansions), superclass.withExpansions(expansions));
}
}
Loading

0 comments on commit 3091552

Please sign in to comment.