Java Reference
In-Depth Information
class
ReachabilityVisitor
extends
NodeVisitor
procedure
( IfTesting
ifn
)
ifn
.
thenPart
.
isReachable
←
true
ifn
.
elsePart
.
isReachable
←
true
call
visit
6
(
ifn
)
thenNormal
←
ifn
.
thenPart
.
terminatesNormally
elseNormal
←
ifn
.
elsePart
.
terminatesNormally
ifn
.
terminatesNormally
←
thenNormal
or
elseNormal
visit
C
hildren
end
procedure
visit
(WhileLooping
wn
)
/
Figure 9.6 on page 352
/
end
procedure
visit
(DoWhileLooping
dwn
)
/
Figure 9.7 on page 354
/
end
procedure
visit
(ForLooping
fn
)
/
Figure 9.8 on page 354
/
end
procedure
( LabeledStmt
ls
)
ls
.
stmt
.
isReachable
←
ls
.
isReachable
call
visit
7
(
ls
)
ls
.
terminatesNormally
←
ls
.
stmt
.
terminatesNormally
visit
C
hildren
end
procedure
(Continuing
cn
)
cn
.
terminatesNormally
←
false
visit
8
end
procedure
visit
(Breaking
fn
)
/
Figure 9.16 on page 360
/
end
procedure
(Returning
rn
)
rn
.
terminatesNormally
←
false
visit
end
end
Figure 9.3: Reachability Analysis Visitors (Part 1)