(node, ctx)
| 586 | } |
| 587 | |
| 588 | function convert (node, ctx) { |
| 589 | if (Array.isArray(node)) { |
| 590 | const result = [] |
| 591 | for (const n of node) { |
| 592 | if (n.leadingComments) { |
| 593 | for (const c of n.leadingComments) { |
| 594 | if (/[Δ∆]/.test(c.value)) continue |
| 595 | c.handled = true |
| 596 | result.push({ |
| 597 | type: 'comment', |
| 598 | fields: { |
| 599 | COMMENT: c.value.substr(1), |
| 600 | }, |
| 601 | start: c.loc.start.line, |
| 602 | end: c.loc.end.line, |
| 603 | }) |
| 604 | } |
| 605 | } |
| 606 | const o = convert(n, ctx) |
| 607 | result.push(o) |
| 608 | } |
| 609 | return nextify(result, ctx) |
| 610 | } |
| 611 | try { |
| 612 | if (!Converters[`Convert${node.type}`]) { |
| 613 | console.log(node) |
| 614 | throw new Error(`No converter for ${node.type}`) |
| 615 | } |
| 616 | const b = Converters[`Convert${node.type}`](node, ctx) |
| 617 | if (b && node.loc) { |
| 618 | b.start = node.loc.start.line |
| 619 | b.end = node.loc.end.line |
| 620 | } |
| 621 | return b |
| 622 | } catch (e) { |
| 623 | console.error('EN', ctx.context, node, e) |
| 624 | let code |
| 625 | |
| 626 | if (node && node.range) code = ctx.code.substr(node.range[0], node.range[1] - node.range[0]) |
| 627 | else if (node) code = ctx.code.substr(node.start, node.end - node.start) |
| 628 | |
| 629 | return { |
| 630 | type: ctx.context === 'value' ? 'raw_code_value' : 'raw_code', |
| 631 | fields: { |
| 632 | CODE: code || '<CoDe>', |
| 633 | }, |
| 634 | } |
| 635 | } |
| 636 | } |
| 637 | |
| 638 | function findAllBlocks (thing) { |
| 639 | const result = [] |
no test coverage detected