| 1961 | } |
| 1962 | |
| 1963 | void BfModule::NewScopeState(bool createLexicalBlock, bool flushValueScope) |
| 1964 | { |
| 1965 | auto curScope = mCurMethodState->mCurScope; |
| 1966 | if (curScope->mLabelNode != NULL) |
| 1967 | { |
| 1968 | curScope->mLabelNode->ToString(curScope->mLabel); |
| 1969 | |
| 1970 | auto rootMethodState = mCurMethodState->GetRootMethodState(); |
| 1971 | curScope->mScopeLocalId = rootMethodState->mCurLocalVarId++; |
| 1972 | auto autoComplete = mCompiler->GetAutoComplete(); |
| 1973 | if (autoComplete != NULL) |
| 1974 | autoComplete->CheckLabel(curScope->mLabelNode, NULL, curScope); |
| 1975 | } |
| 1976 | |
| 1977 | if (!mCurMethodState->mCurScope->mLabel.IsEmpty()) |
| 1978 | { |
| 1979 | auto checkScope = mCurMethodState->mCurScope->mPrevScope; |
| 1980 | while (checkScope != NULL) |
| 1981 | { |
| 1982 | if (checkScope->mLabel == mCurMethodState->mCurScope->mLabel) |
| 1983 | { |
| 1984 | auto errorNode = Warn(0, StrFormat("Duplicate scope label '%s'", checkScope->mLabel.c_str()), curScope->mLabelNode); |
| 1985 | if (errorNode != NULL) |
| 1986 | mCompiler->mPassInstance->MoreInfo("See previous scope label", checkScope->mLabelNode); |
| 1987 | break; |
| 1988 | } |
| 1989 | |
| 1990 | checkScope = checkScope->mPrevScope; |
| 1991 | } |
| 1992 | } |
| 1993 | |
| 1994 | auto prevScope = mCurMethodState->mCurScope->mPrevScope; |
| 1995 | if ((flushValueScope) && (prevScope != NULL) && (prevScope->mValueScopeStart)) |
| 1996 | { |
| 1997 | if (prevScope->mHadScopeValueRetain) |
| 1998 | mBfIRBuilder->CreateValueScopeSoftEnd(prevScope->mValueScopeStart); |
| 1999 | else |
| 2000 | mBfIRBuilder->CreateValueScopeHardEnd(prevScope->mValueScopeStart); |
| 2001 | } |
| 2002 | |
| 2003 | mCurMethodState->mBlockNestLevel++; |
| 2004 | if ((createLexicalBlock) && (mBfIRBuilder->DbgHasInfo()) && (mHasFullDebugInfo)) |
| 2005 | { |
| 2006 | // DIScope could be NULL if we're in an unspecialized method (for example) |
| 2007 | if (mCurMethodState->mCurScope->mDIScope) |
| 2008 | mCurMethodState->mCurScope->mDIScope = mBfIRBuilder->DbgCreateLexicalBlock(mCurMethodState->mCurScope->mDIScope, mCurFilePosition.mFileInstance->mDIFile, mCurFilePosition.mCurLine, mCurFilePosition.mCurColumn); |
| 2009 | } |
| 2010 | mCurMethodState->mCurScope->mLocalVarStart = (int)mCurMethodState->mLocals.size(); |
| 2011 | mCurMethodState->mCurScope->mBlock = mBfIRBuilder->MaybeChainNewBlock((!mCurMethodState->mCurScope->mLabel.empty()) ? mCurMethodState->mCurScope->mLabel : "newScope"); |
| 2012 | mCurMethodState->mCurScope->mMixinState = mCurMethodState->mMixinState; |
| 2013 | } |
| 2014 | |
| 2015 | void BfModule::RestoreScoreState_LocalVariables(int localVarStart) |
| 2016 | { |
no test coverage detected