rubydex 0.2.6 → 0.2.7
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.
- checksums.yaml +4 -4
- data/THIRD_PARTY_LICENSES.html +39 -6
- data/exe/rdx +2 -0
- data/ext/rubydex/declaration.c +115 -106
- data/ext/rubydex/definition.c +100 -80
- data/ext/rubydex/diagnostic.c +5 -0
- data/ext/rubydex/document.c +23 -31
- data/ext/rubydex/extconf.rb +1 -1
- data/ext/rubydex/graph.c +233 -60
- data/ext/rubydex/handle.h +13 -0
- data/ext/rubydex/location.c +5 -0
- data/ext/rubydex/reference.c +51 -46
- data/ext/rubydex/rubydex.c +5 -0
- data/ext/rubydex/signature.c +5 -0
- data/ext/rubydex/utils.c +13 -0
- data/ext/rubydex/utils.h +4 -0
- data/lib/rubydex/bin/rubydex_mcp.exe +0 -0
- data/lib/rubydex/errors.rb +3 -0
- data/lib/rubydex/graph.rb +9 -28
- data/lib/rubydex/version.rb +1 -1
- data/rbi/rubydex.rbi +11 -3
- data/rust/Cargo.lock +119 -14
- data/rust/rubydex/Cargo.toml +19 -1
- data/rust/rubydex/benches/graph_memory.rs +46 -0
- data/rust/rubydex/src/config.rs +275 -0
- data/rust/rubydex/src/errors.rs +2 -0
- data/rust/rubydex/src/lib.rs +7 -0
- data/rust/rubydex/src/model/declaration.rs +12 -51
- data/rust/rubydex/src/model/graph.rs +38 -15
- data/rust/rubydex/src/resolution.rs +2 -12
- data/rust/rubydex-sys/src/graph_api.rs +73 -3
- metadata +4 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9fe9d5528801028a40419f3e7b35f5b74406ae2c24f6ce6252270fe15c2b9b77
|
|
4
|
+
data.tar.gz: 92595d6014a20544bdace0135d4aeea060ee969ab3a10544d02de6796ff9f84e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d43a2e6d81744f688d12ab483b8b4539a7a56144f0d7c7cf20540506bb376903c5d309c255b743ba77277fc82e03f86b70e0416149fdd490743844e913c24be6
|
|
7
|
+
data.tar.gz: 18f6195b18761efdafbe0b9ae7fb9c1ab64bbb607a080fb58792b9f574d17cb6ed25560ff957c5b925186019abbbe509396c2f88dd903c2e625d0265fbb10efa
|
data/THIRD_PARTY_LICENSES.html
CHANGED
|
@@ -50,8 +50,8 @@
|
|
|
50
50
|
|
|
51
51
|
<h2>Overview of licenses:</h2>
|
|
52
52
|
<ul class="licenses-overview">
|
|
53
|
-
<li><a href="#Apache-2.0">Apache License 2.0</a> (
|
|
54
|
-
<li><a href="#MIT">MIT License</a> (
|
|
53
|
+
<li><a href="#Apache-2.0">Apache License 2.0</a> (157)</li>
|
|
54
|
+
<li><a href="#MIT">MIT License</a> (30)</li>
|
|
55
55
|
<li><a href="#Unicode-3.0">Unicode License v3</a> (19)</li>
|
|
56
56
|
<li><a href="#BSD-2-Clause">BSD 2-Clause "Simplified" License</a> (2)</li>
|
|
57
57
|
<li><a href="#BSD-3-Clause">BSD 3-Clause "New" or "Revised" License</a> (1)</li>
|
|
@@ -1049,18 +1049,36 @@
|
|
|
1049
1049
|
<li><a
|
|
1050
1050
|
href=" https://github.com/toml-rs/toml ">serde_spanned
|
|
1051
1051
|
0.6.9</a></li>
|
|
1052
|
+
<li><a
|
|
1053
|
+
href=" https://github.com/toml-rs/toml ">serde_spanned
|
|
1054
|
+
1.1.1</a></li>
|
|
1055
|
+
<li><a
|
|
1056
|
+
href=" https://github.com/tikv/jemallocator ">tikv-jemalloc-ctl
|
|
1057
|
+
0.7.0</a></li>
|
|
1052
1058
|
<li><a
|
|
1053
1059
|
href=" https://github.com/toml-rs/toml ">toml
|
|
1054
1060
|
0.8.23</a></li>
|
|
1061
|
+
<li><a
|
|
1062
|
+
href=" https://github.com/toml-rs/toml ">toml
|
|
1063
|
+
1.1.2+spec-1.1.0</a></li>
|
|
1055
1064
|
<li><a
|
|
1056
1065
|
href=" https://github.com/toml-rs/toml ">toml_datetime
|
|
1057
1066
|
0.6.11</a></li>
|
|
1067
|
+
<li><a
|
|
1068
|
+
href=" https://github.com/toml-rs/toml ">toml_datetime
|
|
1069
|
+
1.1.1+spec-1.1.0</a></li>
|
|
1058
1070
|
<li><a
|
|
1059
1071
|
href=" https://github.com/toml-rs/toml ">toml_edit
|
|
1060
1072
|
0.22.27</a></li>
|
|
1073
|
+
<li><a
|
|
1074
|
+
href=" https://github.com/toml-rs/toml ">toml_parser
|
|
1075
|
+
1.1.2+spec-1.1.0</a></li>
|
|
1061
1076
|
<li><a
|
|
1062
1077
|
href=" https://github.com/toml-rs/toml ">toml_write
|
|
1063
1078
|
0.1.2</a></li>
|
|
1079
|
+
<li><a
|
|
1080
|
+
href=" https://github.com/toml-rs/toml ">toml_writer
|
|
1081
|
+
1.1.1+spec-1.1.0</a></li>
|
|
1064
1082
|
</ul>
|
|
1065
1083
|
<pre class="license-text"> Apache License
|
|
1066
1084
|
Version 2.0, January 2004
|
|
@@ -1993,7 +2011,7 @@ limitations under the License.
|
|
|
1993
2011
|
0.3.2</a></li>
|
|
1994
2012
|
<li><a
|
|
1995
2013
|
href=" https://github.com/rust-lang/hashbrown ">hashbrown
|
|
1996
|
-
0.
|
|
2014
|
+
0.17.1</a></li>
|
|
1997
2015
|
<li><a
|
|
1998
2016
|
href=" https://github.com/withoutboats/heck ">heck
|
|
1999
2017
|
0.5.0</a></li>
|
|
@@ -2005,7 +2023,7 @@ limitations under the License.
|
|
|
2005
2023
|
1.2.1</a></li>
|
|
2006
2024
|
<li><a
|
|
2007
2025
|
href=" https://github.com/indexmap-rs/indexmap ">indexmap
|
|
2008
|
-
2.
|
|
2026
|
+
2.14.0</a></li>
|
|
2009
2027
|
<li><a
|
|
2010
2028
|
href=" https://github.com/rust-itertools/itertools ">itertools
|
|
2011
2029
|
0.13.0</a></li>
|
|
@@ -2048,6 +2066,12 @@ limitations under the License.
|
|
|
2048
2066
|
<li><a
|
|
2049
2067
|
href=" https://github.com/Stebalien/tempfile ">tempfile
|
|
2050
2068
|
3.20.0</a></li>
|
|
2069
|
+
<li><a
|
|
2070
|
+
href=" https://github.com/tikv/jemallocator ">tikv-jemalloc-sys
|
|
2071
|
+
0.7.1+5.3.1-0-g81034ce1f1373e37dc865038e1bc8eeecf559ce8</a></li>
|
|
2072
|
+
<li><a
|
|
2073
|
+
href=" https://github.com/tikv/jemallocator ">tikv-jemallocator
|
|
2074
|
+
0.7.0</a></li>
|
|
2051
2075
|
<li><a
|
|
2052
2076
|
href=" https://github.com/servo/rust-url ">url
|
|
2053
2077
|
2.5.4</a></li>
|
|
@@ -2931,6 +2955,9 @@ limitations under the License.
|
|
|
2931
2955
|
<li><a
|
|
2932
2956
|
href=" https://github.com/rust-lang/rust-analyzer/tree/master/lib/line-index ">line-index
|
|
2933
2957
|
0.1.2</a></li>
|
|
2958
|
+
<li><a
|
|
2959
|
+
href=" https://github.com/dtolnay/paste ">paste
|
|
2960
|
+
1.0.15</a></li>
|
|
2934
2961
|
<li><a
|
|
2935
2962
|
href=" https://github.com/as1100k/pastey ">pastey
|
|
2936
2963
|
0.2.1</a></li>
|
|
@@ -2972,10 +2999,13 @@ limitations under the License.
|
|
|
2972
2999
|
1.0.20</a></li>
|
|
2973
3000
|
<li><a
|
|
2974
3001
|
href=" https://github.com/serde-rs/serde ">serde
|
|
2975
|
-
1.0.
|
|
3002
|
+
1.0.228</a></li>
|
|
3003
|
+
<li><a
|
|
3004
|
+
href=" https://github.com/serde-rs/serde ">serde_core
|
|
3005
|
+
1.0.228</a></li>
|
|
2976
3006
|
<li><a
|
|
2977
3007
|
href=" https://github.com/serde-rs/serde ">serde_derive
|
|
2978
|
-
1.0.
|
|
3008
|
+
1.0.228</a></li>
|
|
2979
3009
|
<li><a
|
|
2980
3010
|
href=" https://github.com/serde-rs/serde ">serde_derive_internals
|
|
2981
3011
|
0.29.1</a></li>
|
|
@@ -3929,6 +3959,9 @@ DEALINGS IN THE SOFTWARE.
|
|
|
3929
3959
|
<li><a
|
|
3930
3960
|
href=" https://github.com/winnow-rs/winnow ">winnow
|
|
3931
3961
|
0.7.12</a></li>
|
|
3962
|
+
<li><a
|
|
3963
|
+
href=" https://github.com/winnow-rs/winnow ">winnow
|
|
3964
|
+
1.0.3</a></li>
|
|
3932
3965
|
</ul>
|
|
3933
3966
|
<pre class="license-text">Permission is hereby granted, free of charge, to any person obtaining
|
|
3934
3967
|
a copy of this software and associated documentation files (the
|
data/exe/rdx
CHANGED
data/ext/rubydex/declaration.c
CHANGED
|
@@ -5,6 +5,11 @@
|
|
|
5
5
|
#include "rustbindings.h"
|
|
6
6
|
#include "utils.h"
|
|
7
7
|
|
|
8
|
+
/*
|
|
9
|
+
* RDoc parser workaround for https://github.com/ruby/rdoc/issues/1744:
|
|
10
|
+
* mRubydex = rb_define_module("Rubydex")
|
|
11
|
+
*/
|
|
12
|
+
|
|
8
13
|
VALUE cDeclaration;
|
|
9
14
|
VALUE cNamespace;
|
|
10
15
|
VALUE cClass;
|
|
@@ -46,42 +51,32 @@ VALUE rdxi_declaration_class_for_kind(CDeclarationKind kind) {
|
|
|
46
51
|
}
|
|
47
52
|
}
|
|
48
53
|
|
|
49
|
-
|
|
54
|
+
/*
|
|
55
|
+
* call-seq:
|
|
56
|
+
* name -> String?
|
|
57
|
+
*
|
|
58
|
+
* Returns the fully qualified declaration name.
|
|
59
|
+
*/
|
|
50
60
|
static VALUE rdxr_declaration_name(VALUE self) {
|
|
51
61
|
HandleData *data;
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
void *graph;
|
|
55
|
-
TypedData_Get_Struct(data->graph_obj, void *, &graph_type, graph);
|
|
62
|
+
void *graph = rdxi_graph_from_handle(self, &data);
|
|
56
63
|
const char *name = rdx_declaration_name(graph, data->id);
|
|
57
64
|
|
|
58
|
-
|
|
59
|
-
return Qnil;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
VALUE str = rb_utf8_str_new_cstr(name);
|
|
63
|
-
free_c_string(name);
|
|
64
|
-
|
|
65
|
-
return str;
|
|
65
|
+
return rdxi_owned_c_string_to_ruby(name);
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
|
|
68
|
+
/*
|
|
69
|
+
* call-seq:
|
|
70
|
+
* unqualified_name -> String?
|
|
71
|
+
*
|
|
72
|
+
* Returns the declaration name without namespace qualification.
|
|
73
|
+
*/
|
|
69
74
|
static VALUE rdxr_declaration_unqualified_name(VALUE self) {
|
|
70
75
|
HandleData *data;
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
void *graph;
|
|
74
|
-
TypedData_Get_Struct(data->graph_obj, void *, &graph_type, graph);
|
|
76
|
+
void *graph = rdxi_graph_from_handle(self, &data);
|
|
75
77
|
const char *name = rdx_declaration_unqualified_name(graph, data->id);
|
|
76
78
|
|
|
77
|
-
|
|
78
|
-
return Qnil;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
VALUE str = rb_utf8_str_new_cstr(name);
|
|
82
|
-
free_c_string(name);
|
|
83
|
-
|
|
84
|
-
return str;
|
|
79
|
+
return rdxi_owned_c_string_to_ruby(name);
|
|
85
80
|
}
|
|
86
81
|
|
|
87
82
|
// Body function for rb_ensure in Declaration#definitions
|
|
@@ -115,10 +110,7 @@ static VALUE declaration_definitions_ensure(VALUE args) {
|
|
|
115
110
|
// Size function for the Declaration#definitions enumerator
|
|
116
111
|
static VALUE declaration_definitions_size(VALUE self, VALUE _args, VALUE _eobj) {
|
|
117
112
|
HandleData *data;
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
void *graph;
|
|
121
|
-
TypedData_Get_Struct(data->graph_obj, void *, &graph_type, graph);
|
|
113
|
+
void *graph = rdxi_graph_from_handle(self, &data);
|
|
122
114
|
struct DefinitionsIter *iter = rdx_declaration_definitions_iter_new(graph, data->id);
|
|
123
115
|
size_t len = rdx_definitions_iter_len(iter);
|
|
124
116
|
rdx_definitions_iter_free(iter);
|
|
@@ -126,18 +118,19 @@ static VALUE declaration_definitions_size(VALUE self, VALUE _args, VALUE _eobj)
|
|
|
126
118
|
return SIZET2NUM(len);
|
|
127
119
|
}
|
|
128
120
|
|
|
129
|
-
|
|
130
|
-
|
|
121
|
+
/*
|
|
122
|
+
* call-seq:
|
|
123
|
+
* definitions -> Enumerator[Rubydex::Definition]
|
|
124
|
+
*
|
|
125
|
+
* Returns an enumerator that yields all definitions for this declaration lazily.
|
|
126
|
+
*/
|
|
131
127
|
static VALUE rdxr_declaration_definitions(VALUE self) {
|
|
132
128
|
if (!rb_block_given_p()) {
|
|
133
129
|
return rb_enumeratorize_with_size(self, rb_str_new2("definitions"), 0, NULL, declaration_definitions_size);
|
|
134
130
|
}
|
|
135
131
|
|
|
136
132
|
HandleData *data;
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
void *graph;
|
|
140
|
-
TypedData_Get_Struct(data->graph_obj, void *, &graph_type, graph);
|
|
133
|
+
void *graph = rdxi_graph_from_handle(self, &data);
|
|
141
134
|
|
|
142
135
|
void *iter = rdx_declaration_definitions_iter_new(graph, data->id);
|
|
143
136
|
VALUE args = rb_ary_new_from_args(2, self, ULL2NUM((uintptr_t)iter));
|
|
@@ -146,14 +139,15 @@ static VALUE rdxr_declaration_definitions(VALUE self) {
|
|
|
146
139
|
return self;
|
|
147
140
|
}
|
|
148
141
|
|
|
149
|
-
|
|
150
|
-
|
|
142
|
+
/*
|
|
143
|
+
* call-seq:
|
|
144
|
+
* member(name) -> Rubydex::Declaration?
|
|
145
|
+
*
|
|
146
|
+
* Returns a declaration handle for the named member, or nil if no member exists.
|
|
147
|
+
*/
|
|
151
148
|
static VALUE rdxr_declaration_member(VALUE self, VALUE name) {
|
|
152
149
|
HandleData *data;
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
void *graph;
|
|
156
|
-
TypedData_Get_Struct(data->graph_obj, void *, &graph_type, graph);
|
|
150
|
+
void *graph = rdxi_graph_from_handle(self, &data);
|
|
157
151
|
|
|
158
152
|
if (TYPE(name) != T_STRING) {
|
|
159
153
|
rb_raise(rb_eTypeError, "expected String");
|
|
@@ -171,8 +165,12 @@ static VALUE rdxr_declaration_member(VALUE self, VALUE name) {
|
|
|
171
165
|
return rb_class_new_instance(2, argv, decl_class);
|
|
172
166
|
}
|
|
173
167
|
|
|
174
|
-
|
|
175
|
-
|
|
168
|
+
/*
|
|
169
|
+
* call-seq:
|
|
170
|
+
* find_member(name, only_inherited: false) -> Rubydex::Declaration?
|
|
171
|
+
*
|
|
172
|
+
* Searches for a member in the declaration's ancestor chain.
|
|
173
|
+
*/
|
|
176
174
|
static VALUE rdxr_declaration_find_member(int argc, VALUE *argv, VALUE self) {
|
|
177
175
|
VALUE member, opts;
|
|
178
176
|
rb_scan_args(argc, argv, "1:", &member, &opts);
|
|
@@ -190,10 +188,7 @@ static VALUE rdxr_declaration_find_member(int argc, VALUE *argv, VALUE self) {
|
|
|
190
188
|
}
|
|
191
189
|
|
|
192
190
|
HandleData *data;
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
void *graph;
|
|
196
|
-
TypedData_Get_Struct(data->graph_obj, void *, &graph_type, graph);
|
|
191
|
+
void *graph = rdxi_graph_from_handle(self, &data);
|
|
197
192
|
|
|
198
193
|
const CDeclaration *decl = rdx_declaration_find_member(graph, data->id, StringValueCStr(member), only_inherited);
|
|
199
194
|
if (decl == NULL) {
|
|
@@ -207,13 +202,15 @@ static VALUE rdxr_declaration_find_member(int argc, VALUE *argv, VALUE self) {
|
|
|
207
202
|
return rb_class_new_instance(2, result_argv, decl_class);
|
|
208
203
|
}
|
|
209
204
|
|
|
210
|
-
|
|
205
|
+
/*
|
|
206
|
+
* call-seq:
|
|
207
|
+
* singleton_class -> Rubydex::SingletonClass?
|
|
208
|
+
*
|
|
209
|
+
* Returns the singleton class declaration, or nil if none exists.
|
|
210
|
+
*/
|
|
211
211
|
static VALUE rdxr_declaration_singleton_class(VALUE self) {
|
|
212
212
|
HandleData *data;
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
void *graph;
|
|
216
|
-
TypedData_Get_Struct(data->graph_obj, void *, &graph_type, graph);
|
|
213
|
+
void *graph = rdxi_graph_from_handle(self, &data);
|
|
217
214
|
const CDeclaration *decl = rdx_declaration_singleton_class(graph, data->id);
|
|
218
215
|
|
|
219
216
|
if (decl == NULL) {
|
|
@@ -227,13 +224,15 @@ static VALUE rdxr_declaration_singleton_class(VALUE self) {
|
|
|
227
224
|
return rb_class_new_instance(2, argv, decl_class);
|
|
228
225
|
}
|
|
229
226
|
|
|
230
|
-
|
|
227
|
+
/*
|
|
228
|
+
* call-seq:
|
|
229
|
+
* owner -> Rubydex::Declaration
|
|
230
|
+
*
|
|
231
|
+
* Returns the owner declaration.
|
|
232
|
+
*/
|
|
231
233
|
static VALUE rdxr_declaration_owner(VALUE self) {
|
|
232
234
|
HandleData *data;
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
void *graph;
|
|
236
|
-
TypedData_Get_Struct(data->graph_obj, void *, &graph_type, graph);
|
|
235
|
+
void *graph = rdxi_graph_from_handle(self, &data);
|
|
237
236
|
const CDeclaration *decl = rdx_declaration_owner(graph, data->id);
|
|
238
237
|
|
|
239
238
|
if (decl == NULL) {
|
|
@@ -247,17 +246,19 @@ static VALUE rdxr_declaration_owner(VALUE self) {
|
|
|
247
246
|
return rb_class_new_instance(2, argv, decl_class);
|
|
248
247
|
}
|
|
249
248
|
|
|
250
|
-
|
|
249
|
+
/*
|
|
250
|
+
* call-seq:
|
|
251
|
+
* ancestors -> Enumerator[Rubydex::Namespace]
|
|
252
|
+
*
|
|
253
|
+
* Returns an enumerator that yields ancestor namespaces.
|
|
254
|
+
*/
|
|
251
255
|
static VALUE rdxr_declaration_ancestors(VALUE self) {
|
|
252
256
|
if (!rb_block_given_p()) {
|
|
253
257
|
return rb_enumeratorize(self, rb_str_new2("ancestors"), 0, NULL);
|
|
254
258
|
}
|
|
255
259
|
|
|
256
260
|
HandleData *data;
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
void *graph;
|
|
260
|
-
TypedData_Get_Struct(data->graph_obj, void *, &graph_type, graph);
|
|
261
|
+
void *graph = rdxi_graph_from_handle(self, &data);
|
|
261
262
|
|
|
262
263
|
void *iter = rdx_declaration_ancestors(graph, data->id);
|
|
263
264
|
if (iter == NULL) {
|
|
@@ -270,17 +271,19 @@ static VALUE rdxr_declaration_ancestors(VALUE self) {
|
|
|
270
271
|
return self;
|
|
271
272
|
}
|
|
272
273
|
|
|
273
|
-
|
|
274
|
+
/*
|
|
275
|
+
* call-seq:
|
|
276
|
+
* descendants -> Enumerator[Rubydex::Namespace]
|
|
277
|
+
*
|
|
278
|
+
* Returns an enumerator that yields descendant namespaces.
|
|
279
|
+
*/
|
|
274
280
|
static VALUE rdxr_declaration_descendants(VALUE self) {
|
|
275
281
|
if (!rb_block_given_p()) {
|
|
276
282
|
return rb_enumeratorize(self, rb_str_new2("descendants"), 0, NULL);
|
|
277
283
|
}
|
|
278
284
|
|
|
279
285
|
HandleData *data;
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
void *graph;
|
|
283
|
-
TypedData_Get_Struct(data->graph_obj, void *, &graph_type, graph);
|
|
286
|
+
void *graph = rdxi_graph_from_handle(self, &data);
|
|
284
287
|
|
|
285
288
|
void *iter = rdx_declaration_descendants(graph, data->id);
|
|
286
289
|
if (iter == NULL) {
|
|
@@ -293,17 +296,19 @@ static VALUE rdxr_declaration_descendants(VALUE self) {
|
|
|
293
296
|
return self;
|
|
294
297
|
}
|
|
295
298
|
|
|
296
|
-
|
|
299
|
+
/*
|
|
300
|
+
* call-seq:
|
|
301
|
+
* members -> Enumerator[Rubydex::Declaration]
|
|
302
|
+
*
|
|
303
|
+
* Returns an enumerator that yields member declarations.
|
|
304
|
+
*/
|
|
297
305
|
static VALUE rdxr_declaration_members(VALUE self) {
|
|
298
306
|
if (!rb_block_given_p()) {
|
|
299
307
|
return rb_enumeratorize(self, rb_str_new2("members"), 0, NULL);
|
|
300
308
|
}
|
|
301
309
|
|
|
302
310
|
HandleData *data;
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
void *graph;
|
|
306
|
-
TypedData_Get_Struct(data->graph_obj, void *, &graph_type, graph);
|
|
311
|
+
void *graph = rdxi_graph_from_handle(self, &data);
|
|
307
312
|
|
|
308
313
|
void *iter = rdx_declaration_members(graph, data->id);
|
|
309
314
|
if (iter == NULL) {
|
|
@@ -319,10 +324,7 @@ static VALUE rdxr_declaration_members(VALUE self) {
|
|
|
319
324
|
// Size function for constant declaration references enumerator
|
|
320
325
|
static VALUE constant_declaration_references_size(VALUE self, VALUE _args, VALUE _eobj) {
|
|
321
326
|
HandleData *data;
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
void *graph;
|
|
325
|
-
TypedData_Get_Struct(data->graph_obj, void *, &graph_type, graph);
|
|
327
|
+
void *graph = rdxi_graph_from_handle(self, &data);
|
|
326
328
|
|
|
327
329
|
struct ConstantReferencesIter *iter = rdx_declaration_constant_references_iter_new(graph, data->id);
|
|
328
330
|
if (iter == NULL) {
|
|
@@ -334,8 +336,12 @@ static VALUE constant_declaration_references_size(VALUE self, VALUE _args, VALUE
|
|
|
334
336
|
return SIZET2NUM(len);
|
|
335
337
|
}
|
|
336
338
|
|
|
337
|
-
|
|
338
|
-
|
|
339
|
+
/*
|
|
340
|
+
* call-seq:
|
|
341
|
+
* references -> Enumerator[Rubydex::ConstantReference]
|
|
342
|
+
*
|
|
343
|
+
* Returns an enumerator that yields constant references to this declaration.
|
|
344
|
+
*/
|
|
339
345
|
static VALUE rdxr_constant_declaration_references(VALUE self) {
|
|
340
346
|
if (!rb_block_given_p()) {
|
|
341
347
|
return rb_enumeratorize_with_size(self, rb_str_new2("references"), 0, NULL,
|
|
@@ -343,10 +349,7 @@ static VALUE rdxr_constant_declaration_references(VALUE self) {
|
|
|
343
349
|
}
|
|
344
350
|
|
|
345
351
|
HandleData *data;
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
void *graph;
|
|
349
|
-
TypedData_Get_Struct(data->graph_obj, void *, &graph_type, graph);
|
|
352
|
+
void *graph = rdxi_graph_from_handle(self, &data);
|
|
350
353
|
|
|
351
354
|
void *iter = rdx_declaration_constant_references_iter_new(graph, data->id);
|
|
352
355
|
if (iter == NULL) {
|
|
@@ -362,10 +365,7 @@ static VALUE rdxr_constant_declaration_references(VALUE self) {
|
|
|
362
365
|
// Size function for method declaration references enumerator
|
|
363
366
|
static VALUE method_declaration_references_size(VALUE self, VALUE _args, VALUE _eobj) {
|
|
364
367
|
HandleData *data;
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
void *graph;
|
|
368
|
-
TypedData_Get_Struct(data->graph_obj, void *, &graph_type, graph);
|
|
368
|
+
void *graph = rdxi_graph_from_handle(self, &data);
|
|
369
369
|
|
|
370
370
|
struct MethodReferencesIter *iter = rdx_declaration_method_references_iter_new(graph, data->id);
|
|
371
371
|
if (iter == NULL) {
|
|
@@ -377,8 +377,12 @@ static VALUE method_declaration_references_size(VALUE self, VALUE _args, VALUE _
|
|
|
377
377
|
return SIZET2NUM(len);
|
|
378
378
|
}
|
|
379
379
|
|
|
380
|
-
|
|
381
|
-
|
|
380
|
+
/*
|
|
381
|
+
* call-seq:
|
|
382
|
+
* references -> Enumerator[Rubydex::MethodReference]
|
|
383
|
+
*
|
|
384
|
+
* Returns an enumerator that yields method references to this declaration.
|
|
385
|
+
*/
|
|
382
386
|
static VALUE rdxr_method_declaration_references(VALUE self) {
|
|
383
387
|
if (!rb_block_given_p()) {
|
|
384
388
|
return rb_enumeratorize_with_size(self, rb_str_new2("references"), 0, NULL,
|
|
@@ -386,10 +390,7 @@ static VALUE rdxr_method_declaration_references(VALUE self) {
|
|
|
386
390
|
}
|
|
387
391
|
|
|
388
392
|
HandleData *data;
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
void *graph;
|
|
392
|
-
TypedData_Get_Struct(data->graph_obj, void *, &graph_type, graph);
|
|
393
|
+
void *graph = rdxi_graph_from_handle(self, &data);
|
|
393
394
|
|
|
394
395
|
void *iter = rdx_declaration_method_references_iter_new(graph, data->id);
|
|
395
396
|
if (iter == NULL) {
|
|
@@ -402,7 +403,12 @@ static VALUE rdxr_method_declaration_references(VALUE self) {
|
|
|
402
403
|
return self;
|
|
403
404
|
}
|
|
404
405
|
|
|
405
|
-
|
|
406
|
+
/*
|
|
407
|
+
* call-seq:
|
|
408
|
+
* references -> Array[untyped]
|
|
409
|
+
*
|
|
410
|
+
* Returns an empty array because variable declarations do not yet support reference lookup.
|
|
411
|
+
*/
|
|
406
412
|
static VALUE rdxr_variable_declaration_references(VALUE self) {
|
|
407
413
|
return rb_ary_new();
|
|
408
414
|
}
|
|
@@ -420,13 +426,15 @@ static VALUE rdxi_visibility_to_symbol(CVisibility visibility) {
|
|
|
420
426
|
}
|
|
421
427
|
}
|
|
422
428
|
|
|
423
|
-
|
|
429
|
+
/*
|
|
430
|
+
* call-seq:
|
|
431
|
+
* visibility -> Symbol
|
|
432
|
+
*
|
|
433
|
+
* Returns the declaration visibility.
|
|
434
|
+
*/
|
|
424
435
|
static VALUE rdxr_declaration_visibility(VALUE self) {
|
|
425
436
|
HandleData *data;
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
void *graph;
|
|
429
|
-
TypedData_Get_Struct(data->graph_obj, void *, &graph_type, graph);
|
|
437
|
+
void *graph = rdxi_graph_from_handle(self, &data);
|
|
430
438
|
|
|
431
439
|
const CVisibility *visibility = rdx_graph_visibility(graph, data->id);
|
|
432
440
|
if (visibility == NULL) {
|
|
@@ -439,15 +447,16 @@ static VALUE rdxr_declaration_visibility(VALUE self) {
|
|
|
439
447
|
return symbol;
|
|
440
448
|
}
|
|
441
449
|
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
450
|
+
/*
|
|
451
|
+
* call-seq:
|
|
452
|
+
* target -> Rubydex::Declaration?
|
|
453
|
+
*
|
|
454
|
+
* Returns the first resolved target declaration for this constant alias, or nil if none of its definitions resolved to
|
|
455
|
+
* a target.
|
|
456
|
+
*/
|
|
445
457
|
static VALUE rdxr_constant_alias_target(VALUE self) {
|
|
446
458
|
HandleData *data;
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
void *graph;
|
|
450
|
-
TypedData_Get_Struct(data->graph_obj, void *, &graph_type, graph);
|
|
459
|
+
void *graph = rdxi_graph_from_handle(self, &data);
|
|
451
460
|
|
|
452
461
|
const CDeclaration *decl = rdx_constant_alias_target(graph, data->id);
|
|
453
462
|
if (decl == NULL) {
|