mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-14 14:24:10 +02:00
Fixed define block srcEnd in initializer block
This commit is contained in:
parent
971cecdd99
commit
c600f86da5
1 changed files with 7 additions and 3 deletions
|
@ -7907,10 +7907,14 @@ BfInitializerExpression* BfReducer::TryCreateInitializerExpression(BfAstNode* ta
|
||||||
{
|
{
|
||||||
if ((allowInitializerStatement) && (!IsInitializerStatement(node)))
|
if ((allowInitializerStatement) && (!IsInitializerStatement(node)))
|
||||||
{
|
{
|
||||||
|
auto defBlock = mAlloc->Alloc<BfBlock>();
|
||||||
|
ReplaceNode(block, defBlock);
|
||||||
|
*defBlock = *block;
|
||||||
|
|
||||||
auto typeDecl = mAlloc->Alloc<BfInitializerTypeDeclaration>();
|
auto typeDecl = mAlloc->Alloc<BfInitializerTypeDeclaration>();
|
||||||
ReplaceNode(node, typeDecl);
|
ReplaceNode(node, typeDecl);
|
||||||
block->mOpenBrace = NULL;
|
defBlock->mOpenBrace = NULL;
|
||||||
MEMBER_SET(typeDecl, mDefineNode, block);
|
MEMBER_SET(typeDecl, mDefineNode, defBlock);
|
||||||
InitAnonymousType(typeDecl);
|
InitAnonymousType(typeDecl);
|
||||||
HandleTypeDeclaration(typeDecl, NULL, NULL, true);
|
HandleTypeDeclaration(typeDecl, NULL, NULL, true);
|
||||||
initializerStartIdx = mVisitorPos.mWritePos;
|
initializerStartIdx = mVisitorPos.mWritePos;
|
||||||
|
@ -7971,7 +7975,7 @@ BfInitializerExpression* BfReducer::TryCreateInitializerExpression(BfAstNode* ta
|
||||||
int srcEnd = block->mSrcEnd;
|
int srcEnd = block->mSrcEnd;
|
||||||
if (initializerStartIdx > 0)
|
if (initializerStartIdx > 0)
|
||||||
srcEnd = block->mChildArr[initializerStartIdx - 1]->mSrcEnd;
|
srcEnd = block->mChildArr[initializerStartIdx - 1]->mSrcEnd;
|
||||||
block->mSrcEnd = srcEnd;
|
typeDecl->mDefineNode->mSrcEnd = srcEnd;
|
||||||
typeDecl->mSrcEnd = srcEnd;
|
typeDecl->mSrcEnd = srcEnd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue