Skip to content

Commit

Permalink
Remove temporary array identifier
Browse files Browse the repository at this point in the history
  • Loading branch information
vtereshkov authored Nov 23, 2024
1 parent 528802d commit 72c08c0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion playground/umka.js

Large diffs are not rendered by default.

9 changes: 4 additions & 5 deletions src/umka_expr.c
Original file line number Diff line number Diff line change
Expand Up @@ -1977,17 +1977,16 @@ static void parseDynArrayLiteral(Compiler *comp, Type **type, Const *constant)
else
{
// Allocate array
Ident *staticArray = identAllocTempVar(&comp->idents, &comp->types, &comp->modules, &comp->blocks, staticArrayType, false);
doZeroVar(comp, staticArray);
const int staticArrayOffset = identAllocStack(&comp->idents, &comp->types, &comp->blocks, staticArrayType);

// Assign items
for (int i = staticArrayType->numItems - 1; i >= 0; i--)
{
genPushLocalPtr(&comp->gen, staticArray->offset + i * itemSize);
genSwapChangeRefCntAssign(&comp->gen, staticArrayType->base);
genPushLocalPtr(&comp->gen, staticArrayOffset + i * itemSize);
genSwapAssign(&comp->gen, staticArrayType->base->kind, typeSizeNoCheck(staticArrayType->base));
}

doPushVarPtr(comp, staticArray);
genPushLocalPtr(&comp->gen, staticArrayOffset);
}

// Convert to dynamic array
Expand Down

0 comments on commit 72c08c0

Please sign in to comment.