(loc: SourceLocation | undefined)
| 24 | root.source = source |
| 25 | |
| 26 | function toSource(loc: SourceLocation | undefined): postcss.Source | undefined { |
| 27 | // Use the fallback if this node has no location info in the AST |
| 28 | if (!loc) return |
| 29 | if (!loc[0]) return |
| 30 | |
| 31 | let table = lineTables.get(loc[0]) |
| 32 | let start = table.find(loc[1]) |
| 33 | let end = table.find(loc[2]) |
| 34 | |
| 35 | return { |
| 36 | input: inputMap.get(loc[0]), |
| 37 | start: { |
| 38 | line: start.line, |
| 39 | column: start.column + 1, |
| 40 | offset: loc[1], |
| 41 | }, |
| 42 | end: { |
| 43 | line: end.line, |
| 44 | column: end.column + 1, |
| 45 | offset: loc[2], |
| 46 | }, |
| 47 | } |
| 48 | } |
| 49 | |
| 50 | function updateSource(astNode: postcss.ChildNode, loc: SourceLocation | undefined) { |
| 51 | let source = toSource(loc) |
no test coverage detected