@@ -797,7 +797,10 @@ public <Q, A> A accept(Visitor<Q, A> v, Q q) {
797
797
private final HashMap <IStatementContainer , Node > entryNodeCache =
798
798
new LinkedHashMap <IStatementContainer , Node >();
799
799
800
- private Node entry (IStatementContainer nd ) {
800
+ /**
801
+ * Gets the entry node (a node without predecessors) for either a Function or a Program `nd`.
802
+ */
803
+ private Node getEntryNode (IStatementContainer nd ) {
801
804
Node entry = entryNodeCache .get (nd );
802
805
if (entry == null ) {
803
806
entry =
@@ -821,7 +824,10 @@ public <Q, A> A accept(Visitor<Q, A> v, Q q) {
821
824
private final HashMap <IStatementContainer , Node > exitNodeCache =
822
825
new LinkedHashMap <IStatementContainer , Node >();
823
826
824
- private Node exit (IStatementContainer nd ) {
827
+ /**
828
+ * Gets the exit node (a node without sucessors) for either a Function or a Program `nd`.
829
+ */
830
+ private Node getExitNode (IStatementContainer nd ) {
825
831
Node exit = exitNodeCache .get (nd );
826
832
if (exit == null ) {
827
833
exit =
@@ -909,7 +915,7 @@ public Object visit(IFunction nd, Void v) {
909
915
}
910
916
911
917
private Object visit (IStatementContainer nd ) {
912
- if (type == JumpType .RETURN ) return exit ((IStatementContainer ) nd );
918
+ if (type == JumpType .RETURN ) return getExitNode ((IStatementContainer ) nd );
913
919
return null ;
914
920
}
915
921
},
@@ -956,7 +962,7 @@ public Void visit(Expression nd, SuccessorInfo i) {
956
962
@ Override
957
963
public Void visit (Program nd , SuccessorInfo i ) {
958
964
this .ctxt .push (nd );
959
- Node entry = this . entry (nd );
965
+ Node entry = getEntryNode (nd );
960
966
961
967
List <ImportDeclaration > imports = scanImports (nd );
962
968
hoistedImports .addAll (imports );
@@ -966,7 +972,7 @@ public Void visit(Program nd, SuccessorInfo i) {
966
972
List <Identifier > fns = HoistedFunDecls .of (nd );
967
973
hoistedFns .addAll (fns );
968
974
969
- Object fst = this .seq (importSpecifiers , fns , nd .getBody (), this .exit (nd ));
975
+ Object fst = this .seq (importSpecifiers , fns , nd .getBody (), this .getExitNode (nd ));
970
976
writeSuccessors (entry , fst );
971
977
this .ctxt .pop ();
972
978
return null ;
@@ -1007,7 +1013,7 @@ private void buildFunctionBody(IFunction nd) {
1007
1013
}
1008
1014
if (nd .hasRest ()) paramsAndDefaults .add ((Expression ) nd .getRest ());
1009
1015
1010
- Node entry = this . entry (nd );
1016
+ Node entry = getEntryNode (nd );
1011
1017
List <Identifier > fns = HoistedFunDecls .of (nd );
1012
1018
hoistedFns .addAll (fns );
1013
1019
@@ -1025,7 +1031,7 @@ private void buildFunctionBody(IFunction nd) {
1025
1031
}
1026
1032
}
1027
1033
1028
- Object fst = this .seq (nd .getBody (), this .exit (nd ));
1034
+ Object fst = this .seq (nd .getBody (), this .getExitNode (nd ));
1029
1035
if (firstField != null ) fst = First .of (firstField );
1030
1036
fst =
1031
1037
this .seq (
0 commit comments