Class: Rubydex::Method

Inherits:
Declaration show all
Defined in:
ext/rubydex/declaration.c

Instance Method Summary collapse

Methods inherited from Declaration

#definitions, #initialize, #name, #owner, #unqualified_name

Constructor Details

This class inherits a constructor from Rubydex::Declaration

Instance Method Details

#referencesObject

Returns an enumerator that yields method references to this declaration



382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
# File 'ext/rubydex/declaration.c', line 382

static VALUE rdxr_method_declaration_references(VALUE self) {
    if (!rb_block_given_p()) {
        return rb_enumeratorize_with_size(self, rb_str_new2("references"), 0, NULL,
                                          method_declaration_references_size);
    }

    HandleData *data;
    TypedData_Get_Struct(self, HandleData, &handle_type, data);

    void *graph;
    TypedData_Get_Struct(data->graph_obj, void *, &graph_type, graph);

    void *iter = rdx_declaration_method_references_iter_new(graph, data->id);
    if (iter == NULL) {
        rb_raise(rb_eRuntimeError, "Declaration not found");
    }

    VALUE args = rb_ary_new_from_args(2, data->graph_obj, ULL2NUM((uintptr_t)iter));
    rb_ensure(rdxi_method_references_yield, args, rdxi_method_references_ensure, args);

    return self;
}