(
node: Node,
source: &str,
lines: &LineIndex<'_>,
file_path: &str,
rows: &mut Vec<ImportRow>,
)
| 202 | } |
| 203 | |
| 204 | fn parse_ts_import_statement( |
| 205 | node: Node, |
| 206 | source: &str, |
| 207 | lines: &LineIndex<'_>, |
| 208 | file_path: &str, |
| 209 | rows: &mut Vec<ImportRow>, |
| 210 | ) { |
| 211 | let line_number = lines.line_for_byte(node.start_byte()) as i64; |
| 212 | let module = node |
| 213 | .child_by_field_name("source") |
| 214 | .map(|n| string_literal_value(n, source)) |
| 215 | .unwrap_or_default(); |
| 216 | |
| 217 | let mut entries = 0usize; |
| 218 | for child in named_children(node) { |
| 219 | match child.kind() { |
| 220 | "import_clause" => { |
| 221 | entries += parse_ts_import_clause( |
| 222 | child, |
| 223 | source, |
| 224 | file_path, |
| 225 | line_number, |
| 226 | &module, |
| 227 | rows, |
| 228 | ); |
| 229 | } |
| 230 | _ => {} |
| 231 | } |
| 232 | } |
| 233 | |
| 234 | if entries == 0 { |
| 235 | rows.push(ImportRow { |
| 236 | file_path: file_path.to_string(), |
| 237 | line_number, |
| 238 | module: module.clone(), |
| 239 | name: None, |
| 240 | alias: None, |
| 241 | kind: "import".to_string(), |
| 242 | is_default: false, |
| 243 | is_wildcard: false, |
| 244 | }); |
| 245 | } |
| 246 | } |
| 247 | |
| 248 | fn parse_ts_import_clause( |
| 249 | clause: Node, |
no test coverage detected