| 139 | } |
| 140 | |
| 141 | export function toNodeDetail(node: Node): WireNodeDetail { |
| 142 | const detail: WireNodeDetail = { |
| 143 | ...toNodeRef(node), |
| 144 | startColumn: node.startColumn, |
| 145 | endColumn: node.endColumn, |
| 146 | lines: Math.max(1, node.endLine - node.startLine + 1), |
| 147 | }; |
| 148 | if (node.docstring) detail.docstring = node.docstring; |
| 149 | if (node.visibility) detail.visibility = node.visibility; |
| 150 | if (node.isAsync) detail.async = true; |
| 151 | if (node.isStatic) detail.static = true; |
| 152 | if (node.isAbstract) detail.abstract = true; |
| 153 | if (node.decorators?.length) detail.decorators = node.decorators; |
| 154 | if (node.typeParameters?.length) detail.typeParameters = node.typeParameters; |
| 155 | if (node.returnType) detail.returnType = node.returnType; |
| 156 | return detail; |
| 157 | } |
| 158 | |
| 159 | // ============================================================================= |
| 160 | // Edge shapes |