MCPcopy Create free account
hub / github.com/mozilla/rhino / tryStatement

Method tryStatement

rhino/src/main/java/org/mozilla/javascript/Parser.java:1927–2092  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1925 }
1926
1927 private TryStatement tryStatement() throws IOException {
1928 if (currentToken != Token.TRY) codeBug();
1929 consumeToken();
1930
1931 // Pull out JSDoc info and reset it before recursing.
1932 Comment jsdocNode = getAndResetJsDoc();
1933
1934 int tryPos = ts.tokenBeg, lineno = lineNumber(), column = columnNumber(), finallyPos = -1;
1935
1936 TryStatement pn = new TryStatement(tryPos);
1937 // Hnadled comment here because there should not be try without LC
1938 int lctt = peekToken();
1939 while (lctt == Token.COMMENT) {
1940 Comment commentNode = scannedComments.get(scannedComments.size() - 1);
1941 pn.setInlineComment(commentNode);
1942 consumeToken();
1943 lctt = peekToken();
1944 }
1945 if (lctt != Token.LC) {
1946 reportError("msg.no.brace.try");
1947 }
1948 AstNode tryBlock = getNextStatementAfterInlineComments(pn);
1949 int tryEnd = getNodeEnd(tryBlock);
1950
1951 List<CatchClause> clauses = null;
1952
1953 boolean sawDefaultCatch = false;
1954 int peek = peekToken();
1955 while (peek == Token.COMMENT) {
1956 Comment commentNode = scannedComments.get(scannedComments.size() - 1);
1957 pn.setInlineComment(commentNode);
1958 consumeToken();
1959 peek = peekToken();
1960 }
1961
1962 boolean previous = hasUndefinedBeenRedefined;
1963 if (peek == Token.CATCH) {
1964 while (matchToken(Token.CATCH, true)) {
1965 int catchLineNum = lineNumber();
1966 if (sawDefaultCatch) {
1967 reportError("msg.catch.unreachable");
1968 }
1969 int catchPos = ts.tokenBeg,
1970 lp = -1,
1971 rp = -1,
1972 guardPos = -1,
1973 catchLine = lineNumber(),
1974 catchColumn = columnNumber();
1975 AstNode varName = null;
1976 AstNode catchCond = null;
1977
1978 switch (peekToken()) {
1979 case Token.LP:
1980 {
1981 matchToken(Token.LP, true);
1982 lp = ts.tokenBeg;
1983
1984 int tt = peekToken();

Callers 1

statementHelperMethod · 0.95

Calls 15

codeBugMethod · 0.95
consumeTokenMethod · 0.95
getAndResetJsDocMethod · 0.95
lineNumberMethod · 0.95
columnNumberMethod · 0.95
peekTokenMethod · 0.95
reportErrorMethod · 0.95
getNodeEndMethod · 0.95
matchTokenMethod · 0.95
markDestructuringMethod · 0.95

Tested by

no test coverage detected