(node: JSONObject)
| 1513 | } |
| 1514 | |
| 1515 | function sourceLocationFromNode(node: JSONObject): JSONObject | null { |
| 1516 | const location = objectValue(node.sourceLocation); |
| 1517 | if (location.file) { |
| 1518 | return location; |
| 1519 | } |
| 1520 | const file = stringValue(node.sourceFile); |
| 1521 | if (!file) { |
| 1522 | return null; |
| 1523 | } |
| 1524 | const locationFromFields: JSONObject = { file }; |
| 1525 | if (typeof node.sourceLine === "number") { |
| 1526 | locationFromFields.line = node.sourceLine; |
| 1527 | } |
| 1528 | if (typeof node.sourceColumn === "number") { |
| 1529 | locationFromFields.column = node.sourceColumn; |
| 1530 | } |
| 1531 | return locationFromFields; |
| 1532 | } |
| 1533 | |
| 1534 | function firstSourceLocationFromNodes(nodes: JSONObject[]): JSONObject | null { |
| 1535 | for (const node of nodes) { |
no test coverage detected