* Invoked when `estraverse` leaves a node during the collection phase. * * @param {Object} options The options for the processor. * @param {Object} state The current state of the processor. * @param {Object} node The node being processed. * @param {Object} parent The parent node. * @
(options, state, node, parent)
| 201 | * @return {Object} The node, processed. |
| 202 | */ |
| 203 | function leaveCollect(options, state, node, parent) { |
| 204 | OBLIGATIONS.precondition(options && typeof options === 'object'); |
| 205 | OBLIGATIONS.precondition(state && typeof state === 'object'); |
| 206 | var __result; |
| 207 | main: { |
| 208 | if (node.type === 'LabeledStatement' && options.supported[node.label.name]) { |
| 209 | state.inLabel = node; |
| 210 | if (!node.body || node.body.type !== 'BlockStatement') { |
| 211 | node.body = { |
| 212 | type: 'BlockStatement', |
| 213 | body: node.body ? [node.body] : [] |
| 214 | }; |
| 215 | } |
| 216 | state.parent = parent; |
| 217 | state.labels.push(node); |
| 218 | } else if (state.labels.length && node === state.ast) { |
| 219 | node = processFunctionBody(node, options); |
| 220 | } else if (state.inLabel && parent === state.parent) { |
| 221 | state.inLabel.body.body.push(node); |
| 222 | __result = { |
| 223 | type: 'EmptyStatement', |
| 224 | deleteMe: true |
| 225 | }; |
| 226 | break main; |
| 227 | } |
| 228 | __result = node; |
| 229 | break main; |
| 230 | } |
| 231 | OBLIGATIONS.postcondition(__result && typeof __result === 'object'); |
| 232 | return __result; |
| 233 | } |
| 234 | /** |
| 235 | * Process a function body, after labels have been collected. |
| 236 | * |
nothing calls this directly
no test coverage detected