Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: imkiva <imkiva@islovely.icu>
- Loading branch information
Showing
4 changed files
with
87 additions
and
78 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Copyright (c) 2020-2021 Yinsen (Tesla) Zhang. | ||
// Use of this source code is governed by the MIT license that can be found in the LICENSE.md file. | ||
package org.aya.cli.library; | ||
|
||
import kala.collection.mutable.DynamicSeq; | ||
import org.aya.cli.library.json.LibraryConfig; | ||
import org.aya.concrete.resolve.ResolveInfo; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
import java.nio.file.Path; | ||
import java.util.Objects; | ||
|
||
public record LibrarySource( | ||
@NotNull LibraryConfig owner, | ||
@NotNull Path file, | ||
@NotNull DynamicSeq<LibrarySource> imports | ||
) { | ||
public LibrarySource(@NotNull LibraryConfig owner, @NotNull Path file) { | ||
this(owner, ResolveInfo.canonicalize(file), DynamicSeq.create()); | ||
} | ||
|
||
@Override public boolean equals(Object o) { | ||
if (this == o) return true; | ||
if (o == null || getClass() != o.getClass()) return false; | ||
LibrarySource that = (LibrarySource) o; | ||
return owner == that.owner && file.equals(that.file); | ||
} | ||
|
||
@Override public int hashCode() { | ||
return Objects.hash(owner, file); | ||
} | ||
} |