rubydex 0.1.0.beta11 → 0.1.0.beta13

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.
Files changed (108) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.txt +23 -23
  3. data/README.md +125 -125
  4. data/THIRD_PARTY_LICENSES.html +2018 -945
  5. data/exe/rdx +47 -47
  6. data/ext/rubydex/declaration.c +453 -388
  7. data/ext/rubydex/declaration.h +23 -23
  8. data/ext/rubydex/definition.c +284 -197
  9. data/ext/rubydex/definition.h +28 -28
  10. data/ext/rubydex/diagnostic.c +6 -6
  11. data/ext/rubydex/diagnostic.h +11 -11
  12. data/ext/rubydex/document.c +97 -98
  13. data/ext/rubydex/document.h +10 -10
  14. data/ext/rubydex/extconf.rb +146 -127
  15. data/ext/rubydex/graph.c +701 -512
  16. data/ext/rubydex/graph.h +10 -10
  17. data/ext/rubydex/handle.h +44 -44
  18. data/ext/rubydex/location.c +22 -22
  19. data/ext/rubydex/location.h +15 -15
  20. data/ext/rubydex/reference.c +123 -104
  21. data/ext/rubydex/reference.h +15 -16
  22. data/ext/rubydex/rubydex.c +22 -22
  23. data/ext/rubydex/utils.c +108 -86
  24. data/ext/rubydex/utils.h +34 -28
  25. data/lib/rubydex/comment.rb +17 -17
  26. data/lib/rubydex/declaration.rb +11 -0
  27. data/lib/rubydex/diagnostic.rb +21 -21
  28. data/lib/rubydex/failures.rb +15 -15
  29. data/lib/rubydex/graph.rb +98 -92
  30. data/lib/rubydex/keyword.rb +17 -0
  31. data/lib/rubydex/keyword_parameter.rb +13 -0
  32. data/lib/rubydex/location.rb +90 -90
  33. data/lib/rubydex/mixin.rb +22 -0
  34. data/lib/rubydex/version.rb +5 -5
  35. data/lib/rubydex.rb +24 -20
  36. data/rbi/rubydex.rbi +425 -310
  37. data/rust/Cargo.lock +1851 -1851
  38. data/rust/Cargo.toml +29 -29
  39. data/rust/about.toml +10 -10
  40. data/rust/{about.hbs → about_templates/about.hbs} +81 -78
  41. data/rust/about_templates/mingw_licenses.hbs +1071 -0
  42. data/rust/rubydex/Cargo.toml +42 -42
  43. data/rust/rubydex/src/compile_assertions.rs +13 -13
  44. data/rust/rubydex/src/diagnostic.rs +110 -109
  45. data/rust/rubydex/src/errors.rs +28 -28
  46. data/rust/rubydex/src/indexing/local_graph.rs +224 -224
  47. data/rust/rubydex/src/indexing/rbs_indexer.rs +1551 -1554
  48. data/rust/rubydex/src/indexing/ruby_indexer.rs +2329 -6753
  49. data/rust/rubydex/src/indexing/ruby_indexer_tests.rs +4962 -0
  50. data/rust/rubydex/src/indexing.rs +210 -210
  51. data/rust/rubydex/src/integrity.rs +279 -278
  52. data/rust/rubydex/src/job_queue.rs +199 -205
  53. data/rust/rubydex/src/lib.rs +17 -17
  54. data/rust/rubydex/src/listing.rs +371 -272
  55. data/rust/rubydex/src/main.rs +160 -160
  56. data/rust/rubydex/src/model/built_in.rs +83 -0
  57. data/rust/rubydex/src/model/comment.rs +24 -24
  58. data/rust/rubydex/src/model/declaration.rs +679 -588
  59. data/rust/rubydex/src/model/definitions.rs +1682 -1602
  60. data/rust/rubydex/src/model/document.rs +222 -252
  61. data/rust/rubydex/src/model/encoding.rs +22 -22
  62. data/rust/rubydex/src/model/graph.rs +3782 -3556
  63. data/rust/rubydex/src/model/id.rs +110 -110
  64. data/rust/rubydex/src/model/identity_maps.rs +58 -58
  65. data/rust/rubydex/src/model/ids.rs +60 -38
  66. data/rust/rubydex/src/model/keywords.rs +256 -256
  67. data/rust/rubydex/src/model/name.rs +298 -298
  68. data/rust/rubydex/src/model/references.rs +111 -111
  69. data/rust/rubydex/src/model/string_ref.rs +50 -50
  70. data/rust/rubydex/src/model/visibility.rs +41 -41
  71. data/rust/rubydex/src/model.rs +15 -14
  72. data/rust/rubydex/src/offset.rs +147 -147
  73. data/rust/rubydex/src/position.rs +6 -6
  74. data/rust/rubydex/src/query.rs +1841 -1700
  75. data/rust/rubydex/src/resolution.rs +1852 -5895
  76. data/rust/rubydex/src/resolution_tests.rs +4701 -0
  77. data/rust/rubydex/src/stats/memory.rs +71 -71
  78. data/rust/rubydex/src/stats/orphan_report.rs +264 -263
  79. data/rust/rubydex/src/stats/timer.rs +127 -127
  80. data/rust/rubydex/src/stats.rs +11 -11
  81. data/rust/rubydex/src/test_utils/context.rs +226 -226
  82. data/rust/rubydex/src/test_utils/graph_test.rs +730 -679
  83. data/rust/rubydex/src/test_utils/local_graph_test.rs +602 -602
  84. data/rust/rubydex/src/test_utils.rs +52 -52
  85. data/rust/rubydex/src/visualization/dot.rs +192 -176
  86. data/rust/rubydex/src/visualization.rs +6 -6
  87. data/rust/rubydex/tests/cli.rs +185 -167
  88. data/rust/rubydex-mcp/Cargo.toml +28 -28
  89. data/rust/rubydex-mcp/src/main.rs +48 -48
  90. data/rust/rubydex-mcp/src/server.rs +1145 -1145
  91. data/rust/rubydex-mcp/src/tools.rs +49 -49
  92. data/rust/rubydex-mcp/tests/mcp.rs +302 -302
  93. data/rust/rubydex-sys/Cargo.toml +20 -20
  94. data/rust/rubydex-sys/build.rs +14 -14
  95. data/rust/rubydex-sys/cbindgen.toml +12 -12
  96. data/rust/rubydex-sys/src/declaration_api.rs +485 -469
  97. data/rust/rubydex-sys/src/definition_api.rs +443 -352
  98. data/rust/rubydex-sys/src/diagnostic_api.rs +99 -99
  99. data/rust/rubydex-sys/src/document_api.rs +85 -54
  100. data/rust/rubydex-sys/src/graph_api.rs +1017 -700
  101. data/rust/rubydex-sys/src/lib.rs +79 -9
  102. data/rust/rubydex-sys/src/location_api.rs +79 -79
  103. data/rust/rubydex-sys/src/name_api.rs +187 -135
  104. data/rust/rubydex-sys/src/reference_api.rs +267 -195
  105. data/rust/rubydex-sys/src/utils.rs +70 -70
  106. data/rust/rustfmt.toml +2 -2
  107. metadata +16 -9
  108. data/lib/rubydex/librubydex_sys.so +0 -0
data/ext/rubydex/graph.h CHANGED
@@ -1,10 +1,10 @@
1
- #ifndef RUBYDEX_GRAPH_H
2
- #define RUBYDEX_GRAPH_H
3
-
4
- #include "ruby.h"
5
-
6
- extern const rb_data_type_t graph_type;
7
-
8
- void rdxi_initialize_graph(VALUE mRubydex);
9
-
10
- #endif // RUBYDEX_GRAPH_H
1
+ #ifndef RUBYDEX_GRAPH_H
2
+ #define RUBYDEX_GRAPH_H
3
+
4
+ #include "ruby.h"
5
+
6
+ extern const rb_data_type_t graph_type;
7
+
8
+ void rdxi_initialize_graph(VALUE mRubydex);
9
+
10
+ #endif // RUBYDEX_GRAPH_H
data/ext/rubydex/handle.h CHANGED
@@ -1,44 +1,44 @@
1
- #ifndef RUBYDEX_HANDLE_H
2
- #define RUBYDEX_HANDLE_H
3
-
4
- #include "ruby.h"
5
-
6
- typedef struct {
7
- VALUE graph_obj; // Ruby Graph object to keep it alive
8
- uint64_t id; // Canonical ID mapping to a DeclarationId, DefinitionId, UriId, etc. See `ids.rs`.
9
- } HandleData;
10
-
11
- static void handle_mark(void *ptr) {
12
- if (ptr) {
13
- HandleData *data = (HandleData *)ptr;
14
- rb_gc_mark(data->graph_obj);
15
- }
16
- }
17
-
18
- static void handle_free(void *ptr) {
19
- if (ptr) {
20
- xfree(ptr);
21
- }
22
- }
23
-
24
- static const rb_data_type_t handle_type = {
25
- "RubydexHandle", {handle_mark, handle_free, 0}, 0, 0, RUBY_TYPED_FREE_IMMEDIATELY};
26
-
27
- static VALUE rdxr_handle_alloc(VALUE klass) {
28
- HandleData *data = ALLOC(HandleData);
29
- data->graph_obj = Qnil;
30
- data->id = 0;
31
-
32
- return TypedData_Wrap_Struct(klass, &handle_type, data);
33
- }
34
-
35
- static VALUE rdxr_handle_initialize(VALUE self, VALUE graph_obj, VALUE id_val) {
36
- HandleData *data;
37
- TypedData_Get_Struct(self, HandleData, &handle_type, data);
38
- data->graph_obj = graph_obj;
39
- data->id = NUM2ULL(id_val);
40
-
41
- return self;
42
- }
43
-
44
- #endif // RUBYDEX_HANDLE_H
1
+ #ifndef RUBYDEX_HANDLE_H
2
+ #define RUBYDEX_HANDLE_H
3
+
4
+ #include "ruby.h"
5
+
6
+ typedef struct {
7
+ VALUE graph_obj; // Ruby Graph object to keep it alive
8
+ uint64_t id; // Canonical ID mapping to a DeclarationId, DefinitionId, UriId, etc. See `ids.rs`.
9
+ } HandleData;
10
+
11
+ static void handle_mark(void *ptr) {
12
+ if (ptr) {
13
+ HandleData *data = (HandleData *)ptr;
14
+ rb_gc_mark(data->graph_obj);
15
+ }
16
+ }
17
+
18
+ static void handle_free(void *ptr) {
19
+ if (ptr) {
20
+ xfree(ptr);
21
+ }
22
+ }
23
+
24
+ static const rb_data_type_t handle_type = {
25
+ "RubydexHandle", {handle_mark, handle_free, 0}, 0, 0, RUBY_TYPED_FREE_IMMEDIATELY};
26
+
27
+ static VALUE rdxr_handle_alloc(VALUE klass) {
28
+ HandleData *data = ALLOC(HandleData);
29
+ data->graph_obj = Qnil;
30
+ data->id = 0;
31
+
32
+ return TypedData_Wrap_Struct(klass, &handle_type, data);
33
+ }
34
+
35
+ static VALUE rdxr_handle_initialize(VALUE self, VALUE graph_obj, VALUE id_val) {
36
+ HandleData *data;
37
+ TypedData_Get_Struct(self, HandleData, &handle_type, data);
38
+ data->graph_obj = graph_obj;
39
+ data->id = NUM2ULL(id_val);
40
+
41
+ return self;
42
+ }
43
+
44
+ #endif // RUBYDEX_HANDLE_H
@@ -1,22 +1,22 @@
1
- #include "location.h"
2
-
3
- VALUE cLocation;
4
-
5
- VALUE rdxi_build_location_value(Location *loc) {
6
- if (loc == NULL) {
7
- return Qnil;
8
- }
9
-
10
- VALUE uri = rb_utf8_str_new_cstr(loc->uri);
11
-
12
- VALUE kwargs = rb_hash_new_capa(5);
13
- rb_hash_aset(kwargs, ID2SYM(rb_intern("uri")), uri);
14
- rb_hash_aset(kwargs, ID2SYM(rb_intern("start_line")), UINT2NUM(loc->start_line));
15
- rb_hash_aset(kwargs, ID2SYM(rb_intern("end_line")), UINT2NUM(loc->end_line));
16
- rb_hash_aset(kwargs, ID2SYM(rb_intern("start_column")), UINT2NUM(loc->start_column));
17
- rb_hash_aset(kwargs, ID2SYM(rb_intern("end_column")), UINT2NUM(loc->end_column));
18
-
19
- return rb_class_new_instance_kw(1, &kwargs, cLocation, RB_PASS_KEYWORDS);
20
- }
21
-
22
- void rdxi_initialize_location(VALUE mRubydex) { cLocation = rb_define_class_under(mRubydex, "Location", rb_cObject); }
1
+ #include "location.h"
2
+
3
+ VALUE cLocation;
4
+
5
+ VALUE rdxi_build_location_value(Location *loc) {
6
+ if (loc == NULL) {
7
+ return Qnil;
8
+ }
9
+
10
+ VALUE uri = rb_utf8_str_new_cstr(loc->uri);
11
+
12
+ VALUE kwargs = rb_hash_new_capa(5);
13
+ rb_hash_aset(kwargs, ID2SYM(rb_intern("uri")), uri);
14
+ rb_hash_aset(kwargs, ID2SYM(rb_intern("start_line")), UINT2NUM(loc->start_line));
15
+ rb_hash_aset(kwargs, ID2SYM(rb_intern("end_line")), UINT2NUM(loc->end_line));
16
+ rb_hash_aset(kwargs, ID2SYM(rb_intern("start_column")), UINT2NUM(loc->start_column));
17
+ rb_hash_aset(kwargs, ID2SYM(rb_intern("end_column")), UINT2NUM(loc->end_column));
18
+
19
+ return rb_class_new_instance_kw(1, &kwargs, cLocation, RB_PASS_KEYWORDS);
20
+ }
21
+
22
+ void rdxi_initialize_location(VALUE mRubydex) { cLocation = rb_define_class_under(mRubydex, "Location", rb_cObject); }
@@ -1,15 +1,15 @@
1
- #ifndef RUBYDEX_LOCATION_H
2
- #define RUBYDEX_LOCATION_H
3
-
4
- #include "ruby.h"
5
- #include "rustbindings.h"
6
-
7
- extern VALUE cLocation;
8
-
9
- void rdxi_initialize_location(VALUE mRubydex);
10
-
11
- // Helper to build a Ruby Rubydex::Location from a C Location pointer.
12
- // Does not take ownership; caller remains responsible for freeing the C Location on the Rust side.
13
- VALUE rdxi_build_location_value(Location *loc);
14
-
15
- #endif // RUBYDEX_LOCATION_H
1
+ #ifndef RUBYDEX_LOCATION_H
2
+ #define RUBYDEX_LOCATION_H
3
+
4
+ #include "ruby.h"
5
+ #include "rustbindings.h"
6
+
7
+ extern VALUE cLocation;
8
+
9
+ void rdxi_initialize_location(VALUE mRubydex);
10
+
11
+ // Helper to build a Ruby Rubydex::Location from a C Location pointer.
12
+ // Does not take ownership; caller remains responsible for freeing the C Location on the Rust side.
13
+ VALUE rdxi_build_location_value(Location *loc);
14
+
15
+ #endif // RUBYDEX_LOCATION_H
@@ -1,104 +1,123 @@
1
- #include "reference.h"
2
- #include "graph.h"
3
- #include "handle.h"
4
- #include "location.h"
5
- #include "rustbindings.h"
6
-
7
- VALUE cReference;
8
- VALUE cConstantReference;
9
- VALUE cMethodReference;
10
-
11
- // ConstantReference#name -> String
12
- static VALUE rdxr_constant_reference_name(VALUE self) {
13
- HandleData *data;
14
- TypedData_Get_Struct(self, HandleData, &handle_type, data);
15
-
16
- void *graph;
17
- TypedData_Get_Struct(data->graph_obj, void *, &graph_type, graph);
18
-
19
- const char *name = rdx_constant_reference_name(graph, data->id);
20
- if (name == NULL) {
21
- return Qnil;
22
- }
23
-
24
- VALUE str = rb_utf8_str_new_cstr(name);
25
- free_c_string(name);
26
- return str;
27
- }
28
-
29
- // ConstantReference#location -> Rubydex::Location
30
- static VALUE rdxr_constant_reference_location(VALUE self) {
31
- HandleData *data;
32
- TypedData_Get_Struct(self, HandleData, &handle_type, data);
33
-
34
- void *graph;
35
- TypedData_Get_Struct(data->graph_obj, void *, &graph_type, graph);
36
-
37
- Location *loc = rdx_constant_reference_location(graph, data->id);
38
- VALUE location = rdxi_build_location_value(loc);
39
- rdx_location_free(loc);
40
- return location;
41
- }
42
-
43
- // MethodReference#name -> String
44
- static VALUE rdxr_method_reference_name(VALUE self) {
45
- HandleData *data;
46
- TypedData_Get_Struct(self, HandleData, &handle_type, data);
47
-
48
- void *graph;
49
- TypedData_Get_Struct(data->graph_obj, void *, &graph_type, graph);
50
-
51
- const char *name = rdx_method_reference_name(graph, data->id);
52
- if (name == NULL) {
53
- return Qnil;
54
- }
55
-
56
- VALUE str = rb_utf8_str_new_cstr(name);
57
- free_c_string(name);
58
- return str;
59
- }
60
-
61
- // MethodReference#location -> Rubydex::Location
62
- static VALUE rdxr_method_reference_location(VALUE self) {
63
- HandleData *data;
64
- TypedData_Get_Struct(self, HandleData, &handle_type, data);
65
-
66
- void *graph;
67
- TypedData_Get_Struct(data->graph_obj, void *, &graph_type, graph);
68
-
69
- Location *loc = rdx_method_reference_location(graph, data->id);
70
- VALUE location = rdxi_build_location_value(loc);
71
- rdx_location_free(loc);
72
- return location;
73
- }
74
-
75
- // Keep this in sync with unresolved_reference_api.rs
76
- VALUE rdxi_reference_class_for_kind(ReferenceKind kind) {
77
- switch (kind) {
78
- case ReferenceKind_Constant:
79
- return cConstantReference;
80
- case ReferenceKind_Method:
81
- return cMethodReference;
82
- default:
83
- rb_raise(rb_eRuntimeError, "Unknown UnresolvedReferenceKind: %d", kind);
84
- }
85
- }
86
-
87
- void rdxi_initialize_reference(VALUE mRubydex) {
88
- cReference = rb_define_class_under(mRubydex, "Reference", rb_cObject);
89
- rb_define_alloc_func(cReference, rdxr_handle_alloc);
90
- rb_define_method(cReference, "initialize", rdxr_handle_initialize, 2);
91
- rb_funcall(rb_singleton_class(cReference), rb_intern("private"), 1, ID2SYM(rb_intern("new")));
92
-
93
- cConstantReference = rb_define_class_under(mRubydex, "ConstantReference", cReference);
94
- rb_define_alloc_func(cConstantReference, rdxr_handle_alloc);
95
- rb_define_method(cConstantReference, "initialize", rdxr_handle_initialize, 2);
96
- rb_define_method(cConstantReference, "name", rdxr_constant_reference_name, 0);
97
- rb_define_method(cConstantReference, "location", rdxr_constant_reference_location, 0);
98
-
99
- cMethodReference = rb_define_class_under(mRubydex, "MethodReference", cReference);
100
- rb_define_alloc_func(cMethodReference, rdxr_handle_alloc);
101
- rb_define_method(cMethodReference, "initialize", rdxr_handle_initialize, 2);
102
- rb_define_method(cMethodReference, "name", rdxr_method_reference_name, 0);
103
- rb_define_method(cMethodReference, "location", rdxr_method_reference_location, 0);
104
- }
1
+ #include "reference.h"
2
+ #include "declaration.h"
3
+ #include "graph.h"
4
+ #include "handle.h"
5
+ #include "location.h"
6
+ #include "rustbindings.h"
7
+
8
+ VALUE cReference;
9
+ VALUE cConstantReference;
10
+ VALUE cUnresolvedConstantReference;
11
+ VALUE cResolvedConstantReference;
12
+ VALUE cMethodReference;
13
+
14
+ // ConstantReference#name -> String
15
+ static VALUE rdxr_constant_reference_name(VALUE self) {
16
+ HandleData *data;
17
+ TypedData_Get_Struct(self, HandleData, &handle_type, data);
18
+
19
+ void *graph;
20
+ TypedData_Get_Struct(data->graph_obj, void *, &graph_type, graph);
21
+
22
+ const char *name = rdx_constant_reference_name(graph, data->id);
23
+ if (name == NULL) {
24
+ return Qnil;
25
+ }
26
+
27
+ VALUE str = rb_utf8_str_new_cstr(name);
28
+ free_c_string(name);
29
+ return str;
30
+ }
31
+
32
+ // ConstantReference#location -> Rubydex::Location
33
+ static VALUE rdxr_constant_reference_location(VALUE self) {
34
+ HandleData *data;
35
+ TypedData_Get_Struct(self, HandleData, &handle_type, data);
36
+
37
+ void *graph;
38
+ TypedData_Get_Struct(data->graph_obj, void *, &graph_type, graph);
39
+
40
+ Location *loc = rdx_constant_reference_location(graph, data->id);
41
+ VALUE location = rdxi_build_location_value(loc);
42
+ rdx_location_free(loc);
43
+ return location;
44
+ }
45
+
46
+ // MethodReference#name -> String
47
+ static VALUE rdxr_method_reference_name(VALUE self) {
48
+ HandleData *data;
49
+ TypedData_Get_Struct(self, HandleData, &handle_type, data);
50
+
51
+ void *graph;
52
+ TypedData_Get_Struct(data->graph_obj, void *, &graph_type, graph);
53
+
54
+ const char *name = rdx_method_reference_name(graph, data->id);
55
+ if (name == NULL) {
56
+ return Qnil;
57
+ }
58
+
59
+ VALUE str = rb_utf8_str_new_cstr(name);
60
+ free_c_string(name);
61
+ return str;
62
+ }
63
+
64
+ // MethodReference#location -> Rubydex::Location
65
+ static VALUE rdxr_method_reference_location(VALUE self) {
66
+ HandleData *data;
67
+ TypedData_Get_Struct(self, HandleData, &handle_type, data);
68
+
69
+ void *graph;
70
+ TypedData_Get_Struct(data->graph_obj, void *, &graph_type, graph);
71
+
72
+ Location *loc = rdx_method_reference_location(graph, data->id);
73
+ VALUE location = rdxi_build_location_value(loc);
74
+ rdx_location_free(loc);
75
+ return location;
76
+ }
77
+
78
+ // ResolvedConstantReference#declaration -> Declaration
79
+ static VALUE rdxr_resolved_constant_reference_declaration(VALUE self) {
80
+ HandleData *data;
81
+ TypedData_Get_Struct(self, HandleData, &handle_type, data);
82
+
83
+ void *graph;
84
+ TypedData_Get_Struct(data->graph_obj, void *, &graph_type, graph);
85
+
86
+ const struct CDeclaration *decl = rdx_resolved_constant_reference_declaration(graph, data->id);
87
+ if (decl == NULL) {
88
+ rb_raise(rb_eRuntimeError, "Invalid declaration for a resolved constant reference");
89
+ }
90
+
91
+ VALUE decl_class = rdxi_declaration_class_for_kind(decl->kind);
92
+ VALUE argv[] = {data->graph_obj, ULL2NUM(decl->id)};
93
+ free_c_declaration(decl);
94
+
95
+ return rb_class_new_instance(2, argv, decl_class);
96
+ }
97
+
98
+ void rdxi_initialize_reference(VALUE mRubydex) {
99
+ cReference = rb_define_class_under(mRubydex, "Reference", rb_cObject);
100
+ rb_define_alloc_func(cReference, rdxr_handle_alloc);
101
+ rb_define_method(cReference, "initialize", rdxr_handle_initialize, 2);
102
+ rb_funcall(rb_singleton_class(cReference), rb_intern("private"), 1, ID2SYM(rb_intern("new")));
103
+
104
+ cConstantReference = rb_define_class_under(mRubydex, "ConstantReference", cReference);
105
+ rb_define_alloc_func(cConstantReference, rdxr_handle_alloc);
106
+ rb_define_method(cConstantReference, "initialize", rdxr_handle_initialize, 2);
107
+ rb_define_method(cConstantReference, "location", rdxr_constant_reference_location, 0);
108
+ rb_funcall(rb_singleton_class(cConstantReference), rb_intern("private"), 1, ID2SYM(rb_intern("new")));
109
+
110
+ cUnresolvedConstantReference = rb_define_class_under(mRubydex, "UnresolvedConstantReference", cConstantReference);
111
+ rb_define_alloc_func(cUnresolvedConstantReference, rdxr_handle_alloc);
112
+ rb_define_method(cUnresolvedConstantReference, "name", rdxr_constant_reference_name, 0);
113
+
114
+ cResolvedConstantReference = rb_define_class_under(mRubydex, "ResolvedConstantReference", cConstantReference);
115
+ rb_define_alloc_func(cResolvedConstantReference, rdxr_handle_alloc);
116
+ rb_define_method(cResolvedConstantReference, "declaration", rdxr_resolved_constant_reference_declaration, 0);
117
+
118
+ cMethodReference = rb_define_class_under(mRubydex, "MethodReference", cReference);
119
+ rb_define_alloc_func(cMethodReference, rdxr_handle_alloc);
120
+ rb_define_method(cMethodReference, "initialize", rdxr_handle_initialize, 2);
121
+ rb_define_method(cMethodReference, "name", rdxr_method_reference_name, 0);
122
+ rb_define_method(cMethodReference, "location", rdxr_method_reference_location, 0);
123
+ }
@@ -1,16 +1,15 @@
1
- #ifndef RUBYDEX_REFERENCE_H
2
- #define RUBYDEX_REFERENCE_H
3
-
4
- #include "ruby.h"
5
- #include "rustbindings.h"
6
-
7
- extern VALUE cReference;
8
- extern VALUE cConstantReference;
9
- extern VALUE cMethodReference;
10
-
11
- void rdxi_initialize_reference(VALUE mRubydex);
12
-
13
- // Returns the Ruby class for a given UnresolvedReferenceKind without calling back into Rust
14
- VALUE rdxi_reference_class_for_kind(ReferenceKind kind);
15
-
16
- #endif // RUBYDEX_REFERENCE_H
1
+ #ifndef RUBYDEX_REFERENCE_H
2
+ #define RUBYDEX_REFERENCE_H
3
+
4
+ #include "ruby.h"
5
+ #include "rustbindings.h"
6
+
7
+ extern VALUE cReference;
8
+ extern VALUE cConstantReference;
9
+ extern VALUE cUnresolvedConstantReference;
10
+ extern VALUE cResolvedConstantReference;
11
+ extern VALUE cMethodReference;
12
+
13
+ void rdxi_initialize_reference(VALUE mRubydex);
14
+
15
+ #endif // RUBYDEX_REFERENCE_H
@@ -1,22 +1,22 @@
1
- #include "declaration.h"
2
- #include "definition.h"
3
- #include "diagnostic.h"
4
- #include "document.h"
5
- #include "graph.h"
6
- #include "location.h"
7
- #include "reference.h"
8
-
9
- VALUE mRubydex;
10
-
11
- void Init_rubydex(void) {
12
- rb_ext_ractor_safe(true);
13
-
14
- mRubydex = rb_define_module("Rubydex");
15
- rdxi_initialize_graph(mRubydex);
16
- rdxi_initialize_declaration(mRubydex);
17
- rdxi_initialize_document(mRubydex);
18
- rdxi_initialize_definition(mRubydex);
19
- rdxi_initialize_location(mRubydex);
20
- rdxi_initialize_diagnostic(mRubydex);
21
- rdxi_initialize_reference(mRubydex);
22
- }
1
+ #include "declaration.h"
2
+ #include "definition.h"
3
+ #include "diagnostic.h"
4
+ #include "document.h"
5
+ #include "graph.h"
6
+ #include "location.h"
7
+ #include "reference.h"
8
+
9
+ VALUE mRubydex;
10
+
11
+ void Init_rubydex(void) {
12
+ rb_ext_ractor_safe(true);
13
+
14
+ mRubydex = rb_define_module("Rubydex");
15
+ rdxi_initialize_graph(mRubydex);
16
+ rdxi_initialize_declaration(mRubydex);
17
+ rdxi_initialize_document(mRubydex);
18
+ rdxi_initialize_definition(mRubydex);
19
+ rdxi_initialize_location(mRubydex);
20
+ rdxi_initialize_diagnostic(mRubydex);
21
+ rdxi_initialize_reference(mRubydex);
22
+ }