Skip to content

Commit 3e2e6b5

Browse files
author
tianqi77
committed
Merge branch 'add-new-system-tests-for-next-and-call' of https://github.com/nus-cs3203/team20-win-spa-20s1 into add-new-system-tests-for-next-and-call
2 parents 7b73c6c + e9a3684 commit 3e2e6b5

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

Team20/Code20/source/Pkb.cpp

+13-4
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,11 @@ void Pkb::deriveTables() {
169169
PkbTableTransformers::closeOnce(prevLineTable));
170170
}
171171

172-
this->closeChildrenTable =
173-
PkbTableTransformers::closeFlatten<PARENT>(childrenTable);
172+
if (!childrenTable.map.empty()) {
173+
this->closeChildrenTable =
174+
PkbTableTransformers::closeWarshall(childrenTable);
175+
}
176+
174177
this->closeCallsTable =
175178
PkbTableTransformers::closeFlatten<CALL>(this->callsTable);
176179
this->closeInvertCallsTable =
@@ -250,7 +253,10 @@ KeysTable<PkbTables::LINE_NO, PkbTables::LINE_NOS> Pkb::deriveNextBipTable() {
250253
nexts.insert(std::get<0>(tuple));
251254
}
252255
}
253-
nextBipTable.insert(std::pair(entry.first, nexts));
256+
257+
if (!nexts.empty()) {
258+
nextBipTable.insert(std::pair(entry.first, nexts));
259+
}
254260
}
255261
return nextBipTable;
256262
}
@@ -371,7 +377,10 @@ Pkb::deriveAffectsBipTable() {
371377
for (LINE_NO assign : allAssignStmts) {
372378
VAR modifiedVar = *std::get<VARS>(modifiesTable.map[assign]).begin();
373379
LINE_NOS affectsBips = getAffectedBipStatements(assign, modifiedVar);
374-
affectsBipTable.insert(std::pair(assign, affectsBips));
380+
381+
if (!affectsBips.empty()) {
382+
affectsBipTable.insert(std::pair(assign, affectsBips));
383+
}
375384
}
376385
return affectsBipTable;
377386
}

0 commit comments

Comments
 (0)