当前位置: 首页>>代码示例>>C++>>正文


C++ MethodTableBucket::public_p方法代码示例

本文整理汇总了C++中MethodTableBucket::public_p方法的典型用法代码示例。如果您正苦于以下问题:C++ MethodTableBucket::public_p方法的具体用法?C++ MethodTableBucket::public_p怎么用?C++ MethodTableBucket::public_p使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MethodTableBucket的用法示例。


在下文中一共展示了MethodTableBucket::public_p方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: fill_private

  bool InlineCache::fill_private(STATE, Symbol* name, Module* start) {
    MethodTableBucket* entry;

    Module* module = start;

    // Check the global cache first!
    GlobalCache::cache_entry* global_entry =
      state->global_cache->lookup(module, name);

    if(global_entry && !global_entry->method_missing) {
      this->method = global_entry->method;
      this->module = global_entry->module;

      return true;
    }

    do {
      entry = module->method_table()->find_entry(state, name);

      /* Nothing, there? Ok, keep looking. */
      if(entry) {

        /* A 'false' method means to terminate method lookup.
         * (eg. undef_method) */
        if(entry->undef_p(state)) return false;

        /* The method was callable, but we need to keep looking
         * for the implementation, so make the invocation bypass all further
         * visibility checks.
         *
         * This is pretty much always where a subclass marks a superclass
         * method as public. We don't move the method, we just put this
         * marker into the method table. */
        if(!entry->method()->nil_p()) {
          this->method = entry->method();
          this->module = module;
          state->global_cache->retain(state, start, name, this->module,
              this->method, false,
              !entry->public_p(state));

          return true;
        }
      }

      module = module->superclass();

      /* No more places to look, we couldn't find it. */
      if(module->nil_p()) return false;
    } while(1);

    // Shouldn't be here!
    rubinius::abort();
  }
开发者ID:burke,项目名称:rubinius,代码行数:53,代码来源:inline_cache.cpp

示例2: fill_public

  MethodMissingReason InlineCache::fill_public(STATE, Object* self, Symbol* name) {
    MethodTableBucket* entry;

    Module* module = klass_;

    // Check the global cache first!
    GlobalCache::cache_entry* global_entry =
      state->global_cache->lookup(module, name);

    if(global_entry &&
        global_entry->is_public &&
        !global_entry->method_missing) {
      this->method = global_entry->method;
      this->module = global_entry->module;

      return eNone;
    }

    bool skip_vis_check = false;

    do {
      entry = module->method_table()->find_entry(state, name);

      /* Nothing, there? Ok, keep looking. */
      if(entry) {
        /* A 'false' method means to terminate method lookup.
         * (eg. undef_method) */
        if(entry->undef_p(state)) return eNormal;

        if(!skip_vis_check) {
          /* The method is private, but this wasn't a private send. */
          if(entry->private_p(state)) {
            return ePrivate;
          } else if(entry->protected_p(state)) {
            /* The method is protected, but it's not being called from
             * the same module */
            if(!self->kind_of_p(state, module)) {
              return eProtected;
            }
          }
        }

        /* The method was callable, but we need to keep looking
         * for the implementation, so make the invocation bypass all further
         * visibility checks.
         *
         * This is pretty much always where a subclass marks a superclass
         * method as public. We don't move the method, we just put this
         * marker into the method table. */
        if(entry->method()->nil_p()) {
          skip_vis_check = true;
        } else {
          this->method = entry->method();
          this->module = module;

          state->global_cache->retain(state, klass_, name, this->module,
                                      this->method, false,
                                      !entry->public_p(state));
          return eNone;
        }
      }

      module = module->superclass();

      /* No more places to look, we couldn't find it. */
      if(module->nil_p()) return eNormal;
    } while(1);

    // Shouldn't be here!
    rubinius::abort();
  }
开发者ID:burke,项目名称:rubinius,代码行数:71,代码来源:inline_cache.cpp


注:本文中的MethodTableBucket::public_p方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。