本文整理汇总了C++中VariableScope::nil_p方法的典型用法代码示例。如果您正苦于以下问题:C++ VariableScope::nil_p方法的具体用法?C++ VariableScope::nil_p怎么用?C++ VariableScope::nil_p使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VariableScope
的用法示例。
在下文中一共展示了VariableScope::nil_p方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: push_local_depth
inline bool push_local_depth(STATE, CallFrame* call_frame, intptr_t depth, intptr_t index) {
if(depth == 0) {
Exception::internal_error(state, "illegal push_local_depth usage");
return false;
} else {
VariableScope* scope = call_frame->scope->parent();
if(!scope || scope->nil_p()) {
Exception::internal_error(state, "illegal push_local_depth usage, no parent");
return false;
}
for(int j = 1; j < depth; j++) {
scope = scope->parent();
if(!scope || scope->nil_p()) {
Exception::internal_error(state, "illegal push_local_depth usage, no parent");
return false;
}
}
if(index >= scope->number_of_locals()) {
Exception::internal_error(state, "illegal push_local_depth usage, bad index");
return false;
}
stack_push(scope->get_local(state, index));
return true;
}
}
示例2: set_locked
Object* VariableScope::set_locked(STATE) {
_flags_ |= CallFrame::cScopeLocked;
VariableScope* parent = this->parent();
while(parent && !parent->nil_p()) {
parent->set_locked(state);
parent = parent->parent();
}
return cNil;
}
示例3: verify_call_frame
/**
* Walks the chain of objects accessible from the specified CallFrame.
*/
void GarbageCollector::verify_call_frame(CallFrame* top_call_frame,
AddressDisplacement* offset)
{
CallFrame* call_frame = top_call_frame;
while(call_frame) {
call_frame = displace(call_frame, offset);
if(call_frame->constant_scope_) {
call_frame->constant_scope_->validate();
}
if(call_frame->compiled_code) {
call_frame->compiled_code->validate();
}
if(call_frame->compiled_code) {
native_int stack_size = call_frame->compiled_code->stack_size()->to_native();
for(native_int i = 0; i < stack_size; i++) {
Object* obj = call_frame->stk[i];
obj->validate();
}
}
VariableScope* scope = call_frame->top_scope_;
if(call_frame->multiple_scopes_p() && scope && !scope->nil_p()) {
scope->validate();
}
if(BlockEnvironment* env = call_frame->block_env()) {
env->validate();
}
Arguments* args = displace(call_frame->arguments, offset);
if(!call_frame->inline_method_p() && args) {
args->recv()->validate();
args->block()->validate();
Object** ary = displace(args->arguments(), offset);
for(uint32_t i = 0; i < args->total(); i++) {
ary[i]->validate();
}
}
if(call_frame->scope && call_frame->compiled_code) {
verify_variable_scope(call_frame, displace(call_frame->scope, offset));
}
call_frame = call_frame->previous;
}
}
示例4: method_scope
VariableScope* CallFrame::method_scope(STATE) {
VariableScope* current = promote_scope(state);
if(!multiple_scopes_p()) return current;
for(;;) {
if(current->block_as_method_p()) return current;
VariableScope* parent = current->parent();
if(!parent->nil_p()) {
current = parent;
} else {
return current;
}
}
assert("should not be here" && 0);
}
示例5: method_scope
VariableScope* CallFrame::method_scope(STATE) {
VariableScope* current = promote_scope(state);
if(!multiple_scopes_p()) return current;
for(;;) {
if(current->block_as_method_p()) return current;
VariableScope* parent = current->parent();
if(!parent->nil_p()) {
current = parent;
} else {
return current;
}
}
// Shouldn't ever get here.
return 0;
}