MCPcopy Create free account
hub / github.com/OpenEndedGroup/Field2 / doCatch

Function doCatch

lib/web/jshint.js:22942–22975  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

22940 var b;
22941
22942 function doCatch() {
22943 advance("catch");
22944 advance("(");
22945
22946 state.funct["(scope)"].stack("catchparams");
22947
22948 if (checkPunctuators(state.tokens.next, ["[", "{"])) {
22949 var tokens = destructuringPattern();
22950 _.each(tokens, function(token) {
22951 if (token.id) {
22952 state.funct["(scope)"].addParam(token.id, token, "exception");
22953 }
22954 });
22955 } else if (state.tokens.next.type !== "(identifier)") {
22956 warning("E030", state.tokens.next, state.tokens.next.value);
22957 } else {
22958 // only advance if we have an identifier so we can continue parsing in the most common error - that no param is given.
22959 state.funct["(scope)"].addParam(identifier(), state.tokens.curr, "exception");
22960 }
22961
22962 if (state.tokens.next.value === "if") {
22963 if (!state.inMoz()) {
22964 warning("W118", state.tokens.curr, "catch filter");
22965 }
22966 advance("if");
22967 expression(0);
22968 }
22969
22970 advance(")");
22971
22972 block(false);
22973
22974 state.funct["(scope)"].unstack();
22975 }
22976
22977 block(true);
22978

Callers 1

jshint.jsFile · 0.85

Calls 7

checkPunctuatorsFunction · 0.85
destructuringPatternFunction · 0.85
warningFunction · 0.85
advanceFunction · 0.70
identifierFunction · 0.70
expressionFunction · 0.70
blockFunction · 0.70

Tested by

no test coverage detected