(n)
| 202 | |
| 203 | const tags = {} |
| 204 | var process = function (n) { |
| 205 | if (n == null) { return } |
| 206 | switch (n.type) { |
| 207 | case 'Program': case 'BlockStatement': |
| 208 | return (() => { |
| 209 | const result = [] |
| 210 | for (n of Array.from(n.body)) { |
| 211 | result.push(process(n)) |
| 212 | } |
| 213 | return result |
| 214 | })() |
| 215 | case 'FunctionDeclaration': |
| 216 | tags['function-def'] = true |
| 217 | if (n.params > 0) { |
| 218 | tags['function-params:' + n.params.length] = true |
| 219 | } |
| 220 | return process(n.body) |
| 221 | case 'ExpressionStatement': |
| 222 | return process(n.expression) |
| 223 | case 'CallExpression': |
| 224 | return process(n.callee) |
| 225 | case 'MemberExpression': |
| 226 | if ((n.object != null ? n.object.name : undefined) === 'hero') { |
| 227 | return tags['hero.' + n.property.name] = true |
| 228 | } |
| 229 | break |
| 230 | case 'WhileStatement': |
| 231 | if ((n.test.type === 'Literal') && (n.test.value === true)) { |
| 232 | tags['while-true'] = true |
| 233 | } else { |
| 234 | tags.while = true |
| 235 | process(n.test) |
| 236 | } |
| 237 | return process(n.body) |
| 238 | case 'ForStatement': |
| 239 | tags.for = true |
| 240 | process(n.init) |
| 241 | process(n.test) |
| 242 | process(n.update) |
| 243 | return process(n.body) |
| 244 | case 'IfStatement': |
| 245 | tags.if = true |
| 246 | process(n.test) |
| 247 | process(n.consequent) |
| 248 | return process(n.alternate) |
| 249 | case 'Literal': |
| 250 | if (n.value === true) { |
| 251 | return tags.true = true |
| 252 | } else { |
| 253 | return tags['literal:' + typeof n.value] = true |
| 254 | } |
| 255 | case 'BinaryExpression':case 'LogicalExpression': |
| 256 | process(n.left) |
| 257 | process(n.right) |
| 258 | return tags[n.operator] = true |
| 259 | case 'AssignmentExpression': |
| 260 | tags['assign:' + n.operator] = true |
| 261 | return process(n.right) |
nothing calls this directly
no outgoing calls
no test coverage detected