Class: Rubydex::MethodReference
- Defined in:
- ext/rubydex/reference.c
Instance Method Summary collapse
- #initialize ⇒ Object constructor
-
#location ⇒ Rubydex::Location
Returns the source location for this method reference.
-
#name ⇒ String
Returns the referenced method name.
-
#receiver ⇒ Rubydex::Declaration?
Returns the resolved declaration for the receiver of the method call.
Constructor Details
#initialize ⇒ Object
Instance Method Details
#location ⇒ Rubydex::Location
Returns the source location for this method reference.
70 71 72 73 74 75 76 77 78 |
# File 'ext/rubydex/reference.c', line 70
static VALUE rdxr_method_reference_location(VALUE self) {
HandleData *data;
void *graph = rdxi_graph_from_handle(self, &data);
Location *loc = rdx_method_reference_location(graph, data->id);
VALUE location = rdxi_build_location_value(loc);
rdx_location_free(loc);
return location;
}
|
#name ⇒ String
Returns the referenced method name.
56 57 58 59 60 61 62 |
# File 'ext/rubydex/reference.c', line 56
static VALUE rdxr_method_reference_name(VALUE self) {
HandleData *data;
void *graph = rdxi_graph_from_handle(self, &data);
const char *name = rdx_method_reference_name(graph, data->id);
return rdxi_owned_c_string_to_ruby(name);
}
|
#receiver ⇒ Rubydex::Declaration?
Returns the resolved declaration for the receiver of the method call. Returns nil when the receiver is not a tracked constant or cannot be resolved.
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'ext/rubydex/reference.c', line 87
static VALUE rdxr_method_reference_receiver(VALUE self) {
HandleData *data;
void *graph = rdxi_graph_from_handle(self, &data);
const struct CDeclaration *decl = rdx_method_reference_receiver_declaration(graph, data->id);
if (decl == NULL) {
return Qnil;
}
VALUE decl_class = rdxi_declaration_class_for_kind(decl->kind);
VALUE argv[] = {data->graph_obj, ULL2NUM(decl->id)};
free_c_declaration(decl);
return rb_class_new_instance(2, argv, decl_class);
}
|