rubydex 0.1.0.beta2 → 0.1.0.beta4

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 (51) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +59 -2
  3. data/THIRD_PARTY_LICENSES.html +25 -2
  4. data/ext/rubydex/declaration.c +148 -9
  5. data/ext/rubydex/declaration.h +12 -0
  6. data/ext/rubydex/definition.c +0 -41
  7. data/ext/rubydex/document.c +2 -2
  8. data/ext/rubydex/extconf.rb +1 -1
  9. data/ext/rubydex/graph.c +114 -54
  10. data/ext/rubydex/handle.h +2 -2
  11. data/ext/rubydex/utils.c +25 -0
  12. data/ext/rubydex/utils.h +6 -0
  13. data/lib/rubydex/graph.rb +44 -16
  14. data/lib/rubydex/librubydex_sys.so +0 -0
  15. data/lib/rubydex/version.rb +1 -1
  16. data/rust/Cargo.lock +27 -5
  17. data/rust/about.toml +1 -0
  18. data/rust/rubydex/Cargo.toml +2 -1
  19. data/rust/rubydex/src/compile_assertions.rs +13 -0
  20. data/rust/rubydex/src/indexing/local_graph.rs +21 -4
  21. data/rust/rubydex/src/indexing/rbs_indexer.rs +29 -0
  22. data/rust/rubydex/src/indexing/ruby_indexer.rs +1241 -598
  23. data/rust/rubydex/src/indexing.rs +19 -9
  24. data/rust/rubydex/src/lib.rs +1 -0
  25. data/rust/rubydex/src/listing.rs +3 -3
  26. data/rust/rubydex/src/main.rs +24 -0
  27. data/rust/rubydex/src/model/declaration.rs +25 -4
  28. data/rust/rubydex/src/model/definitions.rs +29 -41
  29. data/rust/rubydex/src/model/document.rs +141 -0
  30. data/rust/rubydex/src/model/graph.rs +332 -135
  31. data/rust/rubydex/src/model/id.rs +10 -16
  32. data/rust/rubydex/src/model/identity_maps.rs +4 -0
  33. data/rust/rubydex/src/model/ids.rs +7 -1
  34. data/rust/rubydex/src/model/name.rs +131 -26
  35. data/rust/rubydex/src/model/references.rs +18 -36
  36. data/rust/rubydex/src/model/string_ref.rs +10 -4
  37. data/rust/rubydex/src/offset.rs +0 -2
  38. data/rust/rubydex/src/query.rs +177 -2
  39. data/rust/rubydex/src/resolution.rs +499 -688
  40. data/rust/rubydex/src/stats/orphan_report.rs +262 -0
  41. data/rust/rubydex/src/stats.rs +2 -0
  42. data/rust/rubydex/src/test_utils/graph_test.rs +405 -112
  43. data/rust/rubydex/src/visualization/dot.rs +1 -1
  44. data/rust/rubydex-sys/src/declaration_api.rs +240 -13
  45. data/rust/rubydex-sys/src/definition_api.rs +10 -10
  46. data/rust/rubydex-sys/src/document_api.rs +4 -4
  47. data/rust/rubydex-sys/src/graph_api.rs +176 -87
  48. data/rust/rubydex-sys/src/name_api.rs +64 -10
  49. data/rust/rubydex-sys/src/reference_api.rs +7 -7
  50. data/rust/rubydex-sys/src/utils.rs +22 -2
  51. metadata +5 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cb8f807fc83bb4eda600ee3e1beb0946f3aadffe4eec4d73435dc4eaf611339d
4
- data.tar.gz: 0ae8326b457b0ff4defad2fc5ff3c7fe7c368910763d85e2d0a807944d5709aa
3
+ metadata.gz: b478f1b6a25378ce0dfe556a64fcd7f1dac9aee981edec8a77e03a04dc2123ae
4
+ data.tar.gz: d3d9164cca1d9071a8e53b7f5d769eec893f4b251ec95918427ea3ecd6ea30b0
5
5
  SHA512:
6
- metadata.gz: fcc8407ab2077cc18fe1bdfe418bf28edcdbf1c2d4035a1a9d19977084b20acbbc540759e0ef1723fa4fdf0f96daca7867a0d62e19ef1f077acd7d298771a109
7
- data.tar.gz: fb911a5d36c74b7c5a8a70cd9b13faf77ea7289a73d04a69d37aa7ec01fb1e9dc35c4770a25207a5fbd5addefa5b8e0eace9f08425c221349b6c4eab7da59a7b
6
+ metadata.gz: 6fc387f42024ccedb00e8c6feea3c3d6542ad512fa4b20711a4fdf30cf604833ad72ef890cc379024cbab763f3ae27c867e82885993756ac01f6709eb4dac4d8
7
+ data.tar.gz: dc1616a4d88eb7de20099888ca7af449a58dba3cbd79ed63e6acb44066420b402007b6d41d98bb84ae9a83e233a914e345a38992dd34b8cd652c146724b57e6d
data/README.md CHANGED
@@ -11,13 +11,70 @@ of using the Ruby API:
11
11
  ```ruby
12
12
  # Create a new graph representing the current workspace
13
13
  graph = Rubydex::Graph.new
14
+ # Configuring graph LSP encoding
15
+ graph.set_encoding("utf16")
14
16
  # Index the entire workspace with all dependencies
15
17
  graph.index_workspace
18
+ # Or index specific file paths
19
+ graph.index_all(["path/to/file.rb"])
16
20
  # Transform the initially collected information into its semantic understanding by running resolution
17
21
  graph.resolve
22
+ # Get all diagnostics acquired during the analysis
23
+ graph.diagnostics
18
24
 
19
- # Access the information as needed
20
- graph["Foo"]
25
+ # Iterating over graph nodes
26
+ graph.declarations
27
+ graph.documents
28
+ graph.constant_references
29
+ graph.method_references
30
+
31
+ # Analyzing require paths
32
+ graph.resolve_require_path("rails/engine", load_paths) # => document pointed by `rails/engine`
33
+ graph.require_paths(load_paths) # => array of all indexed require paths
34
+
35
+ # Querying
36
+ graph["Foo"] # Get declaration by fully qualified name
37
+ graph.search("Foo#b") # Name search
38
+ graph.resolve_constant("Bar", ["Foo", "Baz::Qux"]) # Resolve constant reference based on nesting
39
+
40
+ # Declarations
41
+ declaration = graph["Foo"]
42
+
43
+ # All declarations include
44
+ declaration.name
45
+ declaration.unqualified_name
46
+ declaration.definitions
47
+ declaration.owner
48
+
49
+ # Namespace declarations include
50
+ declaration.member("bar()")
51
+ declaration.member("@ivar")
52
+ declaration.singleton_class
53
+ declaration.ancestors
54
+ declaration.descendants
55
+
56
+ # Documents
57
+ document = graph.documents.first
58
+ document.uri
59
+ document.definitions # => list of definitions discovered in this document
60
+
61
+ # Definitions
62
+ definition = declaration.definitions.first
63
+ definition.location
64
+ definition.comments
65
+ definition.name
66
+ definition.deprecated?
67
+ definition.name_location
68
+
69
+ # Locations
70
+ location = definition.location
71
+ location.path
72
+
73
+ # Diagnostics
74
+ diagnostic = graph.diagnostics.first
75
+ diagnostic.rule
76
+ diagnostic.message
77
+ diagnostic.location
21
78
  ```
22
79
 
23
80
  ## Contributing
@@ -53,6 +53,7 @@
53
53
  <li><a href="#Apache-2.0">Apache License 2.0</a> (106)</li>
54
54
  <li><a href="#Unicode-3.0">Unicode License v3</a> (19)</li>
55
55
  <li><a href="#MIT">MIT License</a> (15)</li>
56
+ <li><a href="#BSD-2-Clause">BSD 2-Clause &quot;Simplified&quot; License</a> (2)</li>
56
57
  <li><a href="#BSD-3-Clause">BSD 3-Clause &quot;New&quot; or &quot;Revised&quot; License</a> (1)</li>
57
58
  <li><a href="#BSL-1.0">Boost Software License 1.0</a> (1)</li>
58
59
  <li><a href="#ISC">ISC License</a> (1)</li>
@@ -2332,6 +2333,28 @@ distributed under the License is distributed on an &quot;AS IS&quot; BASIS,
2332
2333
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2333
2334
  See the License for the specific language governing permissions and
2334
2335
  limitations under the License.
2336
+ </pre>
2337
+ </li>
2338
+ <li class="license">
2339
+ <h3 id="BSD-2-Clause">BSD 2-Clause &quot;Simplified&quot; License</h3>
2340
+ <h4>Used by:</h4>
2341
+ <ul class="license-used-by">
2342
+ <li><a
2343
+ href=" https://github.com/ruby/rbs.git ">ruby-rbs-sys
2344
+ 0.1.1</a></li>
2345
+ <li><a
2346
+ href=" https://github.com/ruby/rbs.git ">ruby-rbs
2347
+ 0.1.1</a></li>
2348
+ </ul>
2349
+ <pre class="license-text">Copyright (c) &lt;year&gt; &lt;owner&gt;
2350
+
2351
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
2352
+
2353
+ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2354
+
2355
+ 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
2356
+
2357
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &quot;AS IS&quot; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2335
2358
  </pre>
2336
2359
  </li>
2337
2360
  <li class="license">
@@ -2539,10 +2562,10 @@ THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND, EXPRES
2539
2562
  <ul class="license-used-by">
2540
2563
  <li><a
2541
2564
  href=" https://github.com/ruby/prism ">ruby-prism-sys
2542
- 1.6.0</a></li>
2565
+ 1.9.0</a></li>
2543
2566
  <li><a
2544
2567
  href=" https://github.com/ruby/prism ">ruby-prism
2545
- 1.6.0</a></li>
2568
+ 1.9.0</a></li>
2546
2569
  </ul>
2547
2570
  <pre class="license-text">Copyright 2022-present, Shopify Inc.
2548
2571
 
@@ -3,8 +3,45 @@
3
3
  #include "graph.h"
4
4
  #include "handle.h"
5
5
  #include "rustbindings.h"
6
+ #include "utils.h"
6
7
 
7
8
  VALUE cDeclaration;
9
+ VALUE cNamespace;
10
+ VALUE cClass;
11
+ VALUE cModule;
12
+ VALUE cSingletonClass;
13
+ VALUE cConstant;
14
+ VALUE cConstantAlias;
15
+ VALUE cMethod;
16
+ VALUE cGlobalVariable;
17
+ VALUE cInstanceVariable;
18
+ VALUE cClassVariable;
19
+
20
+ // Keep this in sync with declaration_api.rs
21
+ VALUE rdxi_declaration_class_for_kind(CDeclarationKind kind) {
22
+ switch (kind) {
23
+ case CDeclarationKind_Class:
24
+ return cClass;
25
+ case CDeclarationKind_Module:
26
+ return cModule;
27
+ case CDeclarationKind_SingletonClass:
28
+ return cSingletonClass;
29
+ case CDeclarationKind_Constant:
30
+ return cConstant;
31
+ case CDeclarationKind_ConstantAlias:
32
+ return cConstantAlias;
33
+ case CDeclarationKind_Method:
34
+ return cMethod;
35
+ case CDeclarationKind_GlobalVariable:
36
+ return cGlobalVariable;
37
+ case CDeclarationKind_InstanceVariable:
38
+ return cInstanceVariable;
39
+ case CDeclarationKind_ClassVariable:
40
+ return cClassVariable;
41
+ default:
42
+ rb_raise(rb_eRuntimeError, "Unknown CDeclarationKind: %d", kind);
43
+ }
44
+ }
8
45
 
9
46
  // Declaration#name -> String
10
47
  static VALUE rdxr_declaration_name(VALUE self) {
@@ -52,10 +89,10 @@ static VALUE declaration_definitions_yield(VALUE args) {
52
89
  HandleData *data;
53
90
  TypedData_Get_Struct(self, HandleData, &handle_type, data);
54
91
 
55
- int64_t id = 0;
92
+ uint64_t id = 0;
56
93
  DefinitionKind kind;
57
94
  while (rdx_definitions_iter_next(iter, &id, &kind)) {
58
- VALUE argv[] = {data->graph_obj, LL2NUM(id)};
95
+ VALUE argv[] = {data->graph_obj, ULL2NUM(id)};
59
96
  VALUE defn_class = rdxi_definition_class_for_kind(kind);
60
97
  VALUE handle = rb_class_new_instance(2, argv, defn_class);
61
98
  rb_yield(handle);
@@ -120,27 +157,129 @@ static VALUE rdxr_declaration_member(VALUE self, VALUE name) {
120
157
  rb_raise(rb_eTypeError, "expected String");
121
158
  }
122
159
 
123
- const int64_t *id_ptr = rdx_declaration_member(graph, data->id, StringValueCStr(name));
124
- if (id_ptr == NULL) {
160
+ const CDeclaration *decl = rdx_declaration_member(graph, data->id, StringValueCStr(name));
161
+ if (decl == NULL) {
162
+ return Qnil;
163
+ }
164
+
165
+ VALUE decl_class = rdxi_declaration_class_for_kind(decl->kind);
166
+ VALUE argv[] = {data->graph_obj, ULL2NUM(decl->id)};
167
+ free_c_declaration(decl);
168
+
169
+ return rb_class_new_instance(2, argv, decl_class);
170
+ }
171
+
172
+ // Declaration#singleton_class -> SingletonClass
173
+ static VALUE rdxr_declaration_singleton_class(VALUE self) {
174
+ HandleData *data;
175
+ TypedData_Get_Struct(self, HandleData, &handle_type, data);
176
+
177
+ void *graph;
178
+ TypedData_Get_Struct(data->graph_obj, void *, &graph_type, graph);
179
+ const CDeclaration *decl = rdx_declaration_singleton_class(graph, data->id);
180
+
181
+ if (decl == NULL) {
125
182
  return Qnil;
126
183
  }
127
184
 
128
- int64_t id = *id_ptr;
129
- free_i64(id_ptr);
130
- VALUE argv[] = {data->graph_obj, LL2NUM(id)};
185
+ VALUE decl_class = rdxi_declaration_class_for_kind(decl->kind);
186
+ VALUE argv[] = {data->graph_obj, ULL2NUM(decl->id)};
187
+ free_c_declaration(decl);
188
+
189
+ return rb_class_new_instance(2, argv, decl_class);
190
+ }
191
+
192
+ // Declaration#owner -> Declaration
193
+ static VALUE rdxr_declaration_owner(VALUE self) {
194
+ HandleData *data;
195
+ TypedData_Get_Struct(self, HandleData, &handle_type, data);
196
+
197
+ void *graph;
198
+ TypedData_Get_Struct(data->graph_obj, void *, &graph_type, graph);
199
+ const CDeclaration *decl = rdx_declaration_owner(graph, data->id);
200
+
201
+ if (decl == NULL) {
202
+ rb_raise(rb_eRuntimeError, "owner can never be nil for any declarations");
203
+ }
204
+
205
+ VALUE decl_class = rdxi_declaration_class_for_kind(decl->kind);
206
+ VALUE argv[] = {data->graph_obj, ULL2NUM(decl->id)};
207
+ free_c_declaration(decl);
208
+
209
+ return rb_class_new_instance(2, argv, decl_class);
210
+ }
211
+
212
+ // Declaration#ancestors: () -> Enumerator[Declaration]
213
+ static VALUE rdxr_declaration_ancestors(VALUE self) {
214
+ if (!rb_block_given_p()) {
215
+ return rb_enumeratorize(self, rb_str_new2("ancestors"), 0, NULL);
216
+ }
217
+
218
+ HandleData *data;
219
+ TypedData_Get_Struct(self, HandleData, &handle_type, data);
220
+
221
+ void *graph;
222
+ TypedData_Get_Struct(data->graph_obj, void *, &graph_type, graph);
223
+
224
+ void *iter = rdx_declaration_ancestors(graph, data->id);
225
+ if (iter == NULL) {
226
+ rb_raise(rb_eRuntimeError, "failed to create iterator");
227
+ }
228
+
229
+ VALUE args = rb_ary_new_from_args(2, data->graph_obj, ULL2NUM((uintptr_t)iter));
230
+ rb_ensure(rdxi_declarations_yield, args, rdxi_declarations_ensure, args);
231
+
232
+ return self;
233
+ }
234
+
235
+ // Declaration#descendants: () -> Enumerator[Declaration]
236
+ static VALUE rdxr_declaration_descendants(VALUE self) {
237
+ if (!rb_block_given_p()) {
238
+ return rb_enumeratorize(self, rb_str_new2("descendants"), 0, NULL);
239
+ }
240
+
241
+ HandleData *data;
242
+ TypedData_Get_Struct(self, HandleData, &handle_type, data);
243
+
244
+ void *graph;
245
+ TypedData_Get_Struct(data->graph_obj, void *, &graph_type, graph);
246
+
247
+ void *iter = rdx_declaration_descendants(graph, data->id);
248
+ if (iter == NULL) {
249
+ rb_raise(rb_eRuntimeError, "failed to create iterator");
250
+ }
251
+
252
+ VALUE args = rb_ary_new_from_args(2, data->graph_obj, ULL2NUM((uintptr_t)iter));
253
+ rb_ensure(rdxi_declarations_yield, args, rdxi_declarations_ensure, args);
131
254
 
132
- return rb_class_new_instance(2, argv, cDeclaration);
255
+ return self;
133
256
  }
134
257
 
135
258
  void rdxi_initialize_declaration(VALUE mRubydex) {
136
259
  cDeclaration = rb_define_class_under(mRubydex, "Declaration", rb_cObject);
260
+ cNamespace = rb_define_class_under(mRubydex, "Namespace", cDeclaration);
261
+ cClass = rb_define_class_under(mRubydex, "Class", cNamespace);
262
+ cModule = rb_define_class_under(mRubydex, "Module", cNamespace);
263
+ cSingletonClass = rb_define_class_under(mRubydex, "SingletonClass", cNamespace);
264
+ cConstant = rb_define_class_under(mRubydex, "Constant", cDeclaration);
265
+ cConstantAlias = rb_define_class_under(mRubydex, "ConstantAlias", cDeclaration);
266
+ cMethod = rb_define_class_under(mRubydex, "Method", cDeclaration);
267
+ cGlobalVariable = rb_define_class_under(mRubydex, "GlobalVariable", cDeclaration);
268
+ cInstanceVariable = rb_define_class_under(mRubydex, "InstanceVariable", cDeclaration);
269
+ cClassVariable = rb_define_class_under(mRubydex, "ClassVariable", cDeclaration);
137
270
 
138
271
  rb_define_alloc_func(cDeclaration, rdxr_handle_alloc);
139
272
  rb_define_method(cDeclaration, "initialize", rdxr_handle_initialize, 2);
140
273
  rb_define_method(cDeclaration, "name", rdxr_declaration_name, 0);
141
274
  rb_define_method(cDeclaration, "unqualified_name", rdxr_declaration_unqualified_name, 0);
142
275
  rb_define_method(cDeclaration, "definitions", rdxr_declaration_definitions, 0);
143
- rb_define_method(cDeclaration, "member", rdxr_declaration_member, 1);
276
+ rb_define_method(cDeclaration, "owner", rdxr_declaration_owner, 0);
277
+
278
+ // Namespace only methods
279
+ rb_define_method(cNamespace, "member", rdxr_declaration_member, 1);
280
+ rb_define_method(cNamespace, "singleton_class", rdxr_declaration_singleton_class, 0);
281
+ rb_define_method(cNamespace, "ancestors", rdxr_declaration_ancestors, 0);
282
+ rb_define_method(cNamespace, "descendants", rdxr_declaration_descendants, 0);
144
283
 
145
284
  rb_funcall(rb_singleton_class(cDeclaration), rb_intern("private"), 1, ID2SYM(rb_intern("new")));
146
285
  }
@@ -2,9 +2,21 @@
2
2
  #define RUBYDEX_DECLARATION_H
3
3
 
4
4
  #include "ruby.h"
5
+ #include "rustbindings.h"
5
6
 
6
7
  extern VALUE cDeclaration;
8
+ extern VALUE cNamespace;
9
+ extern VALUE cClass;
10
+ extern VALUE cModule;
11
+ extern VALUE cSingletonClass;
12
+ extern VALUE cConstant;
13
+ extern VALUE cConstantAlias;
14
+ extern VALUE cMethod;
15
+ extern VALUE cGlobalVariable;
16
+ extern VALUE cInstanceVariable;
17
+ extern VALUE cClassVariable;
7
18
 
19
+ VALUE rdxi_declaration_class_for_kind(CDeclarationKind kind);
8
20
  void rdxi_initialize_declaration(VALUE mRubydex);
9
21
 
10
22
  #endif // RUBYDEX_DECLARATION_H
@@ -177,58 +177,17 @@ void rdxi_initialize_definition(VALUE mod) {
177
177
  rb_define_method(cDefinition, "name_location", rdxr_definition_name_location, 0);
178
178
 
179
179
  cClassDefinition = rb_define_class_under(mRubydex, "ClassDefinition", cDefinition);
180
- rb_define_alloc_func(cClassDefinition, rdxr_handle_alloc);
181
- rb_define_method(cClassDefinition, "initialize", rdxr_handle_initialize, 2);
182
-
183
180
  cSingletonClassDefinition = rb_define_class_under(mRubydex, "SingletonClassDefinition", cDefinition);
184
- rb_define_alloc_func(cSingletonClassDefinition, rdxr_handle_alloc);
185
- rb_define_method(cSingletonClassDefinition, "initialize", rdxr_handle_initialize, 2);
186
-
187
181
  cModuleDefinition = rb_define_class_under(mRubydex, "ModuleDefinition", cDefinition);
188
- rb_define_alloc_func(cModuleDefinition, rdxr_handle_alloc);
189
- rb_define_method(cModuleDefinition, "initialize", rdxr_handle_initialize, 2);
190
-
191
182
  cConstantDefinition = rb_define_class_under(mRubydex, "ConstantDefinition", cDefinition);
192
- rb_define_alloc_func(cConstantDefinition, rdxr_handle_alloc);
193
- rb_define_method(cConstantDefinition, "initialize", rdxr_handle_initialize, 2);
194
-
195
183
  cConstantAliasDefinition = rb_define_class_under(mRubydex, "ConstantAliasDefinition", cDefinition);
196
- rb_define_alloc_func(cConstantAliasDefinition, rdxr_handle_alloc);
197
- rb_define_method(cConstantAliasDefinition, "initialize", rdxr_handle_initialize, 2);
198
-
199
184
  cMethodDefinition = rb_define_class_under(mRubydex, "MethodDefinition", cDefinition);
200
- rb_define_alloc_func(cMethodDefinition, rdxr_handle_alloc);
201
- rb_define_method(cMethodDefinition, "initialize", rdxr_handle_initialize, 2);
202
-
203
185
  cAttrAccessorDefinition = rb_define_class_under(mRubydex, "AttrAccessorDefinition", cDefinition);
204
- rb_define_alloc_func(cAttrAccessorDefinition, rdxr_handle_alloc);
205
- rb_define_method(cAttrAccessorDefinition, "initialize", rdxr_handle_initialize, 2);
206
-
207
186
  cAttrReaderDefinition = rb_define_class_under(mRubydex, "AttrReaderDefinition", cDefinition);
208
- rb_define_alloc_func(cAttrReaderDefinition, rdxr_handle_alloc);
209
- rb_define_method(cAttrReaderDefinition, "initialize", rdxr_handle_initialize, 2);
210
-
211
187
  cAttrWriterDefinition = rb_define_class_under(mRubydex, "AttrWriterDefinition", cDefinition);
212
- rb_define_alloc_func(cAttrWriterDefinition, rdxr_handle_alloc);
213
- rb_define_method(cAttrWriterDefinition, "initialize", rdxr_handle_initialize, 2);
214
-
215
188
  cGlobalVariableDefinition = rb_define_class_under(mRubydex, "GlobalVariableDefinition", cDefinition);
216
- rb_define_alloc_func(cGlobalVariableDefinition, rdxr_handle_alloc);
217
- rb_define_method(cGlobalVariableDefinition, "initialize", rdxr_handle_initialize, 2);
218
-
219
189
  cInstanceVariableDefinition = rb_define_class_under(mRubydex, "InstanceVariableDefinition", cDefinition);
220
- rb_define_alloc_func(cInstanceVariableDefinition, rdxr_handle_alloc);
221
- rb_define_method(cInstanceVariableDefinition, "initialize", rdxr_handle_initialize, 2);
222
-
223
190
  cClassVariableDefinition = rb_define_class_under(mRubydex, "ClassVariableDefinition", cDefinition);
224
- rb_define_alloc_func(cClassVariableDefinition, rdxr_handle_alloc);
225
- rb_define_method(cClassVariableDefinition, "initialize", rdxr_handle_initialize, 2);
226
-
227
191
  cMethodAliasDefinition = rb_define_class_under(mRubydex, "MethodAliasDefinition", cDefinition);
228
- rb_define_alloc_func(cMethodAliasDefinition, rdxr_handle_alloc);
229
- rb_define_method(cMethodAliasDefinition, "initialize", rdxr_handle_initialize, 2);
230
-
231
192
  cGlobalVariableAliasDefinition = rb_define_class_under(mRubydex, "GlobalVariableAliasDefinition", cDefinition);
232
- rb_define_alloc_func(cGlobalVariableAliasDefinition, rdxr_handle_alloc);
233
- rb_define_method(cGlobalVariableAliasDefinition, "initialize", rdxr_handle_initialize, 2);
234
193
  }
@@ -33,10 +33,10 @@ static VALUE document_definitions_yield(VALUE args) {
33
33
  HandleData *data;
34
34
  TypedData_Get_Struct(self, HandleData, &handle_type, data);
35
35
 
36
- int64_t id = 0;
36
+ uint64_t id = 0;
37
37
  DefinitionKind kind;
38
38
  while (rdx_definitions_iter_next(iter, &id, &kind)) {
39
- VALUE argv[] = {data->graph_obj, LL2NUM(id)};
39
+ VALUE argv[] = {data->graph_obj, ULL2NUM(id)};
40
40
  VALUE defn_class = rdxi_definition_class_for_kind(kind);
41
41
  VALUE handle = rb_class_new_instance(2, argv, defn_class);
42
42
  rb_yield(handle);
@@ -56,7 +56,7 @@ end
56
56
  create_makefile("rubydex/rubydex")
57
57
 
58
58
  cargo_command = if ENV["SANITIZER"]
59
- ENV["RUSTFLAGS"] = "-Zsanitizer=#{ENV["SANITIZER"]}"
59
+ ENV["RUSTFLAGS"] = "-Zsanitizer=#{ENV["SANITIZER"]} -C target-cpu=x86-64-v3"
60
60
  "cargo +nightly build -Zbuild-std #{cargo_args.join(" ")}".strip
61
61
  else
62
62
  "cargo build #{cargo_args.join(" ")}".strip