Object* Autoload::resolve(STATE, GCToken gct, CallFrame* call_frame, bool honor_require) { Autoload* self = this; OnStack<1> os(state, self); Object* res = send(state, call_frame, state->symbol("resolve")); if(!res) return NULL; if(CBOOL(res) || !honor_require) { ConstantMissingReason reason = vNonExistent; Object* constant = Helpers::const_get(state, call_frame, self->name(), &reason, self, true); if(!constant) return NULL; if(reason == vFound) { return constant; } return Helpers::const_missing(state, self->name(), call_frame); } return cNil; }
Object* Autoload::resolve(STATE, CallFrame* call_frame, bool honor_require) { Autoload* self = this; OnStack<1> os(state, self); Object* res = send(state, call_frame, state->symbol("resolve")); if(!res) return NULL; if(CBOOL(res) || !honor_require) { bool found; Object* constant = Helpers::const_get(state, call_frame, self->name(), &found, self); if(!constant) return NULL; if(found) { return constant; } return Helpers::const_missing(state, self->name(), call_frame); } return cNil; }
Object* Autoload::resolve(STATE, Module* under, bool honor_require) { Autoload* self = this; OnStack<2> os(state, self, under); Object* res = send(state, state->symbol("resolve")); if(!res) return NULL; if(CBOOL(res) || !honor_require) { ConstantMissingReason reason = vNonExistent; Object* constant = Helpers::const_get_under( state, under, self->name(), &reason, self, true); if(!constant) return NULL; if(reason == vFound) return constant; return Helpers::const_missing_under(state, under, self->name()); } return cNil; }