rubydex 0.1.0.beta13 → 0.1.0.beta14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -424,6 +424,34 @@ pub unsafe extern "C" fn rdx_declaration_members(pointer: GraphPointer, decl_id:
424
424
  DeclarationsIter::new(declarations.into_boxed_slice())
425
425
  }
426
426
 
427
+ /// Returns the first resolved target declaration for a constant alias declaration, or NULL if the declaration is not
428
+ /// a constant alias or none of its definitions have a resolved target.
429
+ ///
430
+ /// # Safety
431
+ ///
432
+ /// Assumes that the graph pointer is valid.
433
+ ///
434
+ /// # Panics
435
+ ///
436
+ /// Will panic if there's inconsistent graph data
437
+ #[unsafe(no_mangle)]
438
+ pub unsafe extern "C" fn rdx_constant_alias_target(pointer: GraphPointer, decl_id: u64) -> *const CDeclaration {
439
+ with_graph(pointer, |graph| {
440
+ let declaration_id = DeclarationId::new(decl_id);
441
+
442
+ let Some(targets) = graph.alias_targets(&declaration_id) else {
443
+ return ptr::null();
444
+ };
445
+
446
+ let Some(&target_id) = targets.first() else {
447
+ return ptr::null();
448
+ };
449
+
450
+ let target_decl = graph.declarations().get(&target_id).unwrap();
451
+ Box::into_raw(Box::new(CDeclaration::from_declaration(target_id, target_decl))).cast_const()
452
+ })
453
+ }
454
+
427
455
  /// Creates a new iterator over constant references for a given declaration.
428
456
  ///
429
457
  /// # Safety
@@ -44,9 +44,10 @@ pub fn nesting_stack_to_name_id(
44
44
  }
45
45
 
46
46
  /// Processes a qualified name (e.g., `"Foo::Bar"` or `"<Foo>"`) by splitting on `"::"` and registering each part in the
47
- /// graph. Singleton class names (starting with `<`) use `ParentScope::Attached` and `nesting=None`, matching how the
48
- /// indexer creates them. When a singleton is the first part (i.e., `current_name` has no parent), `current_nesting` is
49
- /// used as the attachment point.
47
+ /// graph. Singleton class names (starting with `<`) use `ParentScope::Attached` and a `nesting` equal to the attached
48
+ /// target, matching how the indexer creates them (`class << self` always sits lexically inside its attached class).
49
+ /// When a singleton is the first part (i.e., `current_name` has no parent), `current_nesting` is used as the attachment
50
+ /// point.
50
51
  fn process_qualified_name(
51
52
  graph: &mut Graph,
52
53
  qualified_name: &str,
@@ -61,12 +62,13 @@ fn process_qualified_name(
61
62
  }
62
63
 
63
64
  let (parent_scope, nesting_for_part) = if part.starts_with('<') {
64
- let attached = match *current_name {
65
- ParentScope::Some(id) | ParentScope::Attached(id) => ParentScope::Attached(id),
66
- _ => current_nesting.map_or(ParentScope::None, ParentScope::Attached),
65
+ let attached_id = match *current_name {
66
+ ParentScope::Some(id) | ParentScope::Attached(id) => Some(id),
67
+ _ => *current_nesting,
67
68
  };
68
69
 
69
- (attached, None)
70
+ let attached = attached_id.map_or(ParentScope::None, ParentScope::Attached);
71
+ (attached, attached_id)
70
72
  } else {
71
73
  (*current_name, *current_nesting)
72
74
  };
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubydex
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.beta13
4
+ version: 0.1.0.beta14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shopify
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-04-21 00:00:00.000000000 Z
11
+ date: 2026-04-28 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A high-performance static analysis suite for Ruby, built in Rust with
14
14
  Ruby APIs