コード例 #1
0
ファイル: helpers.cpp プロジェクト: fakeleft/rubinius
    Class* open_class(STATE, GCToken gct, CallFrame* call_frame, Module* under, Object* super, Symbol* name, bool* created) {
      bool found;

      *created = false;

      Object* obj = under->get_const(state, name, &found);

      OnStack<4> os(state, under, super, name, obj);

      if(found) {
        TypedRoot<Object*> sup(state, super);

        if(Autoload* autoload = try_as<Autoload>(obj)) {
          obj = autoload->resolve(state, gct, call_frame, true);

          // Check if an exception occurred
          if(!obj) return NULL;
        }

        // Autoload::resolve will return nil if code loading failed, in which
        // case we ignore the autoload.
        if(!obj->nil_p()) {
          return check_superclass(state, call_frame, as<Class>(obj), sup.get());
        }
      }

      *created = true;
      return add_class(state, under, super, name);
    }
コード例 #2
0
    Class* open_class(STATE, GCToken gct, CallFrame* call_frame, Module* under, Object* super, Symbol* name, bool* created) {
      ConstantMissingReason reason;

      *created = false;

      Object* obj = under->get_const(state, name, G(sym_public), &reason);

      if(reason == vFound) {
        OnStack<4> os(state, under, super, name, obj);

        if(Autoload* autoload = try_as<Autoload>(obj)) {
          obj = autoload->resolve(state, gct, call_frame, under, true);

          // Check if an exception occurred
          if(!obj) return NULL;
        }

        // Autoload::resolve will return nil if code loading failed, in which
        // case we ignore the autoload.
        if(!obj->nil_p()) {
          return check_superclass(state, call_frame, as<Class>(obj), super);
        }
      }

      *created = true;
      return add_class(state, under, super, name);
    }
コード例 #3
0
ファイル: helpers.cpp プロジェクト: Gimi/rubinius
    Class* open_class(STATE, CallFrame* call_frame, Module* under, Object* super, Symbol* name, bool* created) {
      bool found;

      *created = false;

      Object* obj = under->get_const(state, name, &found);
      if(found) {
        TypedRoot<Object*> sup(state, super);

        if(Autoload* autoload = try_as<Autoload>(obj)) {
          obj = autoload->resolve(state, call_frame);

          // Check if an exception occurred
          if(!obj) return NULL;
        }

        return check_superclass(state, call_frame, as<Class>(obj), sup.get());
      }

      *created = true;
      return add_class(state, under, super, name);
    }