NodeConstant::NodeConstant(const Token& tok, SymbolWithValue * symptr, CompilerState & state) : NodeTerminal(state), m_token(tok), m_constSymbol(symptr), m_ready(false), m_constType(Nouti), m_currBlockNo(0) { assert(symptr); m_currBlockNo = symptr->getBlockNoOfST(); m_ready = updateConstant(); //sets ready here m_constType = m_constSymbol->getUlamTypeIdx(); }
void NodeConstant::genCode(File * fp, UVPass& uvpass) { if(!isReadyConstant()) m_ready = updateConstant(); //sets ready here assert(isReadyConstant()); //must be NodeTerminal::genCode(fp, uvpass); } //genCode
UTI NodeConstant::checkAndLabelType() { UTI it = Nav; bool stubcopy = m_state.isClassAStub(m_state.getCompileThisIdx()); //instantiate, look up in class block; skip if stub copy and already ready. if(!stubcopy && m_constSymbol == NULL) checkForSymbol(); else { stubcopy = m_state.hasClassAStub(m_state.getCompileThisIdx()); //includes ancestors } if(m_constSymbol) { it = m_constSymbol->getUlamTypeIdx(); } else if(isReadyConstant() && stubcopy) { assert(m_state.okUTItoContinue(m_constType)); setNodeType(m_constType); //t3565, t3640, t3641, t3642, t3652 //stub copy case: still wants uti mapping it = NodeTerminal::checkAndLabelType(); } else if(stubcopy) { // still need its symbol for a value // use the member class (unlike checkForSymbol) } // map incomplete UTI if(!m_state.isComplete(it)) //reloads to recheck { std::ostringstream msg; msg << "Incomplete " << prettyNodeName().c_str() << " for type: "; msg << m_state.getUlamTypeNameBriefByIndex(it).c_str(); msg << ", used with constant symbol name '"; msg << m_state.getTokenDataAsString(m_token).c_str() << "'"; MSG(getNodeLocationAsString().c_str(), msg.str().c_str(), WAIT); //wait until updateConstant tried. } setNodeType(it); Node::setStoreIntoAble(TBOOL_FALSE); //copy m_constant from Symbol into NodeTerminal parent. if(!isReadyConstant()) m_ready = updateConstant(); //sets ready here if(!isReadyConstant()) { it = Hzy; if(!stubcopy) m_constSymbol = NULL; //lookup again too! (e.g. inherited template instances) m_state.setGoAgain(); } return it; } //checkAndLabelType
void dx11ShaderProgram::setConstant(int index, ConstantType type, int mult, const void *ptr) { if (updateConstant(index, type, mult, ptr)) { if (uniforms[index].vertexShader) cbvMod = true; else cbpMod = true; } }
EvalStatus NodeConstant::eval() { if(!isReadyConstant()) m_ready = updateConstant(); if(!isReadyConstant()) return ERROR; if(!m_state.isComplete(getNodeType())) return ERROR; return NodeTerminal::eval(); } //eval
bool ContactManager::onContactBeginPro_End(){ target_pro = node_Pro->getScheduler()->pauseAllTargets(); MenuManager menuManager; Node* layer =menuManager.create_Menu(SUCCESS_LAYER); getScore(); strstream ss; string score; ss<<SCORE_GET; ss>>score; auto text_score=layer->getChildByName<ui::TextBMFont*>("Text_Score"); text_score->setString(score); if(GameManager::stepNow==STEP){ STEP++; } //此处应该有个算星星的方法 int stateN = getState(); strstream ss1; string state; ss1<<stateN; ss1>>state; CCLOG("星星:%d",stateN); auto text_state=layer->getChildByName<ui::TextBMFont*>("Text_State"); text_state->setString(state); GameVo gVo; GameVo gvoG = getGameInfo(GameManager::stepNow); if(gvoG._score<SCORE_GET){ gVo.setData(SCORE_GET, 3, getState()); setGameInfo(gVo,GameManager::stepNow); } updateConstant(); node_else->getParent()->addChild(layer); MenuManager::move_in(layer); return false; }