()
| 2953 | // 12.8 The break statement |
| 2954 | |
| 2955 | function parseBreakStatement() { |
| 2956 | var label = null, key; |
| 2957 | |
| 2958 | expectKeyword('break'); |
| 2959 | |
| 2960 | // Catch the very common case first: immediately a semicolon (U+003B). |
| 2961 | if (source.charCodeAt(index) === 0x3B) { |
| 2962 | lex(); |
| 2963 | |
| 2964 | if (!(state.inIteration || state.inSwitch)) { |
| 2965 | throwError({}, Messages.IllegalBreak); |
| 2966 | } |
| 2967 | |
| 2968 | return delegate.createBreakStatement(null); |
| 2969 | } |
| 2970 | |
| 2971 | if (peekLineTerminator()) { |
| 2972 | if (!(state.inIteration || state.inSwitch)) { |
| 2973 | throwError({}, Messages.IllegalBreak); |
| 2974 | } |
| 2975 | |
| 2976 | return delegate.createBreakStatement(null); |
| 2977 | } |
| 2978 | |
| 2979 | if (lookahead.type === Token.Identifier) { |
| 2980 | label = parseVariableIdentifier(); |
| 2981 | |
| 2982 | key = '$' + label.name; |
| 2983 | if (!Object.prototype.hasOwnProperty.call(state.labelSet, key)) { |
| 2984 | throwError({}, Messages.UnknownLabel, label.name); |
| 2985 | } |
| 2986 | } |
| 2987 | |
| 2988 | consumeSemicolon(); |
| 2989 | |
| 2990 | if (label === null && !(state.inIteration || state.inSwitch)) { |
| 2991 | throwError({}, Messages.IllegalBreak); |
| 2992 | } |
| 2993 | |
| 2994 | return delegate.createBreakStatement(label); |
| 2995 | } |
| 2996 | |
| 2997 | // 12.9 The return statement |
| 2998 |
no test coverage detected