(stream, state)
| 206 | // arrow, and not declare the arguments as locals for the arrow |
| 207 | // body. |
| 208 | function findFatArrow(stream, state) { |
| 209 | if (state.fatArrowAt) state.fatArrowAt = null; |
| 210 | var arrow = stream.string.indexOf("=>", stream.start); |
| 211 | if (arrow < 0) return; |
| 212 | |
| 213 | if (isTS) { // Try to skip TypeScript return type declarations after the arguments |
| 214 | var m = /:\s*(?:\w+(?:<[^>]*>|\[\])?|\{[^}]*\})\s*$/.exec(stream.string.slice(stream.start, arrow)) |
| 215 | if (m) arrow = m.index |
| 216 | } |
| 217 | |
| 218 | var depth = 0, sawSomething = false; |
| 219 | for (var pos = arrow - 1; pos >= 0; --pos) { |
| 220 | var ch = stream.string.charAt(pos); |
| 221 | var bracket = brackets.indexOf(ch); |
| 222 | if (bracket >= 0 && bracket < 3) { |
| 223 | if (!depth) { ++pos; break; } |
| 224 | if (--depth == 0) { if (ch == "(") sawSomething = true; break; } |
| 225 | } else if (bracket >= 3 && bracket < 6) { |
| 226 | ++depth; |
| 227 | } else if (wordRE.test(ch)) { |
| 228 | sawSomething = true; |
| 229 | } else if (/["'\/]/.test(ch)) { |
| 230 | return; |
| 231 | } else if (sawSomething && !depth) { |
| 232 | ++pos; |
| 233 | break; |
| 234 | } |
| 235 | } |
| 236 | if (sawSomething && !depth) state.fatArrowAt = pos; |
| 237 | } |
| 238 | |
| 239 | // Parser |
| 240 |
no outgoing calls
no test coverage detected