(opts)
| 19943 | } |
| 19944 | |
| 19945 | function parseComma(opts) { |
| 19946 | opts = opts || {}; |
| 19947 | |
| 19948 | if (!opts.peek) { |
| 19949 | nobreakcomma(state.tokens.curr, state.tokens.next); |
| 19950 | advance(","); |
| 19951 | } else { |
| 19952 | nobreakcomma(state.tokens.prev, state.tokens.curr); |
| 19953 | } |
| 19954 | |
| 19955 | if (state.tokens.next.identifier && !(opts.property && state.inES5())) { |
| 19956 | // Keywords that cannot follow a comma operator. |
| 19957 | switch (state.tokens.next.value) { |
| 19958 | case "break": |
| 19959 | case "case": |
| 19960 | case "catch": |
| 19961 | case "continue": |
| 19962 | case "default": |
| 19963 | case "do": |
| 19964 | case "else": |
| 19965 | case "finally": |
| 19966 | case "for": |
| 19967 | case "if": |
| 19968 | case "in": |
| 19969 | case "instanceof": |
| 19970 | case "return": |
| 19971 | case "switch": |
| 19972 | case "throw": |
| 19973 | case "try": |
| 19974 | case "var": |
| 19975 | case "let": |
| 19976 | case "while": |
| 19977 | case "with": |
| 19978 | error("E024", state.tokens.next, state.tokens.next.value); |
| 19979 | return false; |
| 19980 | } |
| 19981 | } |
| 19982 | |
| 19983 | if (state.tokens.next.type === "(punctuator)") { |
| 19984 | switch (state.tokens.next.value) { |
| 19985 | case "}": |
| 19986 | case "]": |
| 19987 | case ",": |
| 19988 | if (opts.allowTrailing) { |
| 19989 | return true; |
| 19990 | } |
| 19991 | |
| 19992 | /* falls through */ |
| 19993 | case ")": |
| 19994 | error("E024", state.tokens.next, state.tokens.next.value); |
| 19995 | return false; |
| 19996 | } |
| 19997 | } |
| 19998 | return true; |
| 19999 | } |
| 20000 | |
| 20001 | // Functional constructors for making the symbols that will be inherited by |
| 20002 | // tokens. |
no test coverage detected