mirror of
https://github.com/irmen/prog8.git
synced 2025-10-25 05:18:38 +00:00
GoSub no longer inherits from Jump node, fixes subtle ast/codegen bugs related to jsrs
This commit is contained in:
@@ -103,6 +103,17 @@ class CallGraph(private val program: Program) : IAstVisitor {
|
||||
super.visit(jump)
|
||||
}
|
||||
|
||||
override fun visit(gosub: GoSub) {
|
||||
val otherSub = gosub.identifier?.targetSubroutine(program)
|
||||
if (otherSub != null) {
|
||||
gosub.definingSubroutine?.let { thisSub ->
|
||||
calls[thisSub] = calls.getValue(thisSub) + otherSub
|
||||
calledBy[otherSub] = calledBy.getValue(otherSub) + gosub
|
||||
}
|
||||
}
|
||||
super.visit(gosub)
|
||||
}
|
||||
|
||||
override fun visit(identifier: IdentifierReference) {
|
||||
allIdentifiersAndTargets[Pair(identifier, identifier.position)] = identifier.targetStatement(program)!!
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user