Skip to content

Commit

Permalink
Replace duplicate hasTestablePackage with containsTestablePkg
Browse files Browse the repository at this point in the history
  • Loading branch information
Shadow-Devil committed Nov 5, 2024
1 parent c5bb91b commit 871d329
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,8 @@ public void visit(BLangPackage pkgNode) {
.filter(f -> !f.flagSet.contains(Flag.LAMBDA))
.toList());

if (!(pkgNode instanceof BLangTestablePackage)) {
find(pkgNode.getTestablePkg().orElse(null));
if (!(pkgNode instanceof BLangTestablePackage) && pkgNode.containsTestablePkg()) {
find(pkgNode.getTestablePkg().orElseThrow());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ public void performCodeGen(ModuleContext moduleContext, CompilationCache compila
return;
}

if (!bLangPackage.hasTestablePackage()) {
if (!bLangPackage.containsTestablePkg()) {
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ public BLangPackage genBIR(BLangPackage astPkg) {
astPkg.accept(this);

this.birOptimizer.optimizePackage(birPkg);
if (!astPkg.moduleContextDataHolder.skipTests() && astPkg.hasTestablePackage()) {
if (!astPkg.moduleContextDataHolder.skipTests() && astPkg.containsTestablePkg()) {
astPkg.getTestablePkgs().forEach(testPkg -> {
BIRPackage testBirPkg = new BIRPackage(testPkg.pos, testPkg.packageID.orgName,
testPkg.packageID.pkgName, testPkg.packageID.name, testPkg.packageID.version,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ private void validateModulePackages(ModuleId moduleId, CompilerBackend compilerB

private void validateTestPackages(ModuleId moduleId, CompilerBackend compilerBackend,
BLangPackage bLangPackage) {
if (bLangPackage.moduleContextDataHolder.skipTests() || !bLangPackage.hasTestablePackage()) {
if (bLangPackage.moduleContextDataHolder.skipTests() || !bLangPackage.containsTestablePkg()) {
return;
}
Set<Path> testDependencies = getPlatformDependencyPaths(moduleId, compilerBackend,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,10 +274,6 @@ public Set<Flag> getFlags() {
return flagSet;
}

public boolean hasTestablePackage() {
return !this.testablePkgs.isEmpty();
}

public void addClassDefinition(BLangClassDefinition classDefNode) {
this.topLevelNodes.add(classDefNode);
this.classDefinitions.add(classDefNode);
Expand Down

0 comments on commit 871d329

Please sign in to comment.