Пример #1
0
  ConstantCache* ConstantCache::empty(STATE, Symbol* name, Executable* executable, int ip) {
    ConstantCache* cache = state->new_object_dirty<ConstantCache>(G(constant_cache));

    cache->name(state, name);
    cache->executable(state, executable);
    cache->ip_ = ip;
    cache->value(state, cNil);
    cache->under(state, nil<Module>());
    cache->scope(state, nil<ConstantScope>());
    cache->serial_ = -1;
    return cache;
  }
Пример #2
0
  ConstantCache* ConstantCache::create(STATE, ConstantCache* existing, Object* value, Module* under,
                                             ConstantScope* scope) {
    ConstantCache* cache = state->new_object_dirty<ConstantCache>(G(constant_cache));

    cache->name(state, existing->name());
    cache->executable(state, existing->executable());
    cache->ip_ = existing->ip();
    cache->value(state, value);
    cache->under(state, under);
    cache->scope(state, scope);
    cache->serial_ = state->shared().global_serial();
    return cache;
  }