endCheck() examines the body of a function, doing a basic reachability analysis and returns a combination of flags END_ flags that indicate how the function execution can terminate. These constitute only the pessimistic set of termination conditions. It is possible that at runtime certain code paths
()
| 879 | * @return logical OR of END_* flags |
| 880 | */ |
| 881 | private int endCheck() { |
| 882 | switch (type) { |
| 883 | case Token.BREAK: |
| 884 | return endCheckBreak(); |
| 885 | |
| 886 | case Token.EXPR_VOID: |
| 887 | if (this.first != null) return first.endCheck(); |
| 888 | return END_DROPS_OFF; |
| 889 | |
| 890 | case Token.YIELD: |
| 891 | case Token.YIELD_STAR: |
| 892 | return END_YIELDS; |
| 893 | |
| 894 | case Token.CONTINUE: |
| 895 | case Token.THROW: |
| 896 | return END_UNREACHED; |
| 897 | |
| 898 | case Token.RETURN: |
| 899 | if (this.first != null) return END_RETURNS_VALUE; |
| 900 | return END_RETURNS; |
| 901 | |
| 902 | case Token.TARGET: |
| 903 | if (next != null) return next.endCheck(); |
| 904 | return END_DROPS_OFF; |
| 905 | |
| 906 | case Token.LOOP: |
| 907 | return endCheckLoop(); |
| 908 | |
| 909 | case Token.LOCAL_BLOCK: |
| 910 | case Token.BLOCK: |
| 911 | // there are several special kinds of blocks |
| 912 | if (first == null) return END_DROPS_OFF; |
| 913 | |
| 914 | switch (first.type) { |
| 915 | case Token.LABEL: |
| 916 | return first.endCheckLabel(); |
| 917 | |
| 918 | case Token.IFNE: |
| 919 | return first.endCheckIf(); |
| 920 | |
| 921 | case Token.SWITCH: |
| 922 | return first.endCheckSwitch(); |
| 923 | |
| 924 | case Token.TRY: |
| 925 | return first.endCheckTry(); |
| 926 | |
| 927 | default: |
| 928 | return endCheckBlock(); |
| 929 | } |
| 930 | |
| 931 | default: |
| 932 | return END_DROPS_OFF; |
| 933 | } |
| 934 | } |
| 935 | |
| 936 | public boolean hasSideEffects() { |
| 937 | switch (type) { |
no test coverage detected