Skip to content

Remove misleading CommonInst::method #333

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ import org.jacodb.api.common.CommonMethod

interface CommonInst {
val location: CommonInstLocation

val method: CommonMethod
get() = location.method
}

interface CommonInstLocation {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ interface JcInst : CommonInst {
override val location: JcInstLocation
val operands: List<JcExpr>

override val method: JcMethod
get() = location.method
val lineNumber: Int
get() = location.lineNumber

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ class JcBlockGraphImpl(
(block.start.index..block.end.index).map { jcGraph.instructions[it] }

override fun block(inst: JcInst): JcBasicBlock {
assert(inst.method == jcGraph.method) {
"required method of instruction ${jcGraph.method} but got ${inst.method}"
assert(inst.location.method == jcGraph.method) {
"required method of instruction ${jcGraph.method} but got ${inst.location.method}"
}
for (basicBlock in entries) {
if (basicBlock.contains(inst)) {
Expand Down
3 changes: 0 additions & 3 deletions jacodb-ets/src/main/kotlin/org/jacodb/ets/model/Stmt.kt
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ import org.jacodb.api.common.cfg.CommonReturnInst
interface EtsStmt : CommonInst {
override val location: EtsStmtLocation

override val method: EtsMethod
get() = location.method

interface Visitor<out R> {
fun visit(stmt: EtsNopStmt): R
fun visit(stmt: EtsAssignStmt): R
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ fun InterproceduralCfg.toHighlightedDotWithCalls(
val h = sanitize(stmt.hashCode())
val clusterName = "cluster_${h}_B${parentBlock}"
// method signature label
val methodSig = cfg.entries.first().method.signature
val methodSig = cfg.entries.first().location.method.signature
// open subgraph
lines += " subgraph \"$clusterName\" {"
lines += " label=\"$methodSig\";"
Expand Down