MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / extract_identifier_reference

Method extract_identifier_reference

atomic-semantic/src/parser.rs:366–493  ·  view source on GitHub ↗

Extract a reference from an identifier

(
        &self,
        node: &Node,
        source: &str,
        file_path: &str,
        seen: &mut HashSet<(String, u32)>,
    )

Source from the content-addressed store, hash-verified

364
365 /// Extract a reference from an identifier
366 fn extract_identifier_reference(
367 &self,
368 node: &Node,
369 source: &str,
370 file_path: &str,
371 seen: &mut HashSet<(String, u32)>,
372 ) -> Option<Reference> {
373 let symbol = node.utf8_text(source.as_bytes()).ok()?.to_string();
374 let line = node.start_position().row as u32 + 1;
375
376 // Skip keywords and common built-ins
377 if matches!(
378 symbol.as_str(),
379 "true"
380 | "false"
381 | "null"
382 | "undefined"
383 | "this"
384 | "super"
385 | "console"
386 | "window"
387 | "document"
388 | "global"
389 | "process"
390 | "module"
391 | "exports"
392 | "require"
393 | "import"
394 | "export"
395 | "default"
396 | "async"
397 | "await"
398 | "new"
399 | "delete"
400 | "typeof"
401 | "instanceof"
402 | "void"
403 | "yield"
404 | "return"
405 | "throw"
406 | "try"
407 | "catch"
408 | "finally"
409 | "if"
410 | "else"
411 | "switch"
412 | "case"
413 | "break"
414 | "continue"
415 | "for"
416 | "while"
417 | "do"
418 | "in"
419 | "of"
420 | "with"
421 | "debugger"
422 | "class"
423 | "extends"

Callers 1

Calls 7

okMethod · 0.45
as_bytesMethod · 0.45
lenMethod · 0.45
cloneMethod · 0.45
containsMethod · 0.45
insertMethod · 0.45
linesMethod · 0.45

Tested by

no test coverage detected