void CodeGenerateVisitor::Visit(Chunk *chunk, void *data) { // Generate function auto func = state_->NewFunction(); func->SetBaseInfo(chunk->module_, 0); func->SetSuperior(func_); func_ = func; func_state_ = gen_state_.PushFunctionState(); chunk->block_->Accept(this, data); // Generate closure auto cl = state_->NewClosure(); cl->SetPrototype(func); // Add Env as closure upvalue cl->AddUpvalue(state_->GetGlobal(), Upvalue::Stack); // Add closure to stack state_->stack_.top_->closure_ = cl; state_->stack_.top_->type_ = ValueT_Closure; state_->stack_.top_++; }
void COptionsDlg::SetDefaults() { SetBaseInfo(m_DefaultState); InitState(); theApp.GetMain()->GetMixerDlg().SetDefaults(); // reset mixer state too }