* @param {Ast.Node} node
(node)
| 155 | * @param {Ast.Node} node |
| 156 | */ |
| 157 | function restoreNameAndValue(node) { |
| 158 | switch (node.kind) { |
| 159 | case "element": |
| 160 | restoreName(node); |
| 161 | for (const attr of node.attrs) { |
| 162 | restoreName(attr); |
| 163 | if (!attr.valueSpan) { |
| 164 | attr.value = null; |
| 165 | } else { |
| 166 | attr.value = attr.valueSpan.toString(); |
| 167 | if (/["']/.test(attr.value[0])) { |
| 168 | attr.value = attr.value.slice(1, -1); |
| 169 | } |
| 170 | } |
| 171 | } |
| 172 | break; |
| 173 | |
| 174 | case "comment": |
| 175 | node.value = node.sourceSpan |
| 176 | .toString() |
| 177 | .slice("<!--".length, -"-->".length); |
| 178 | break; |
| 179 | |
| 180 | case "text": |
| 181 | node.value = node.sourceSpan.toString(); |
| 182 | break; |
| 183 | |
| 184 | // No default |
| 185 | } |
| 186 | } |
| 187 | |
| 188 | /** |
| 189 | * @param {Ast.Node} node |
no test coverage detected
searching dependent graphs…