mirror of
https://github.com/luau-lang/luau.git
synced 2025-05-04 10:33:46 +01:00
Pre-allocate registers, getting better errors
This commit is contained in:
parent
e42e7884bb
commit
4504b05b76
1 changed files with 4 additions and 5 deletions
|
@ -1529,11 +1529,10 @@ struct Compiler
|
||||||
// bytecode.emitABC(LOP_LOADK, target, formatStringIndex, 0);
|
// bytecode.emitABC(LOP_LOADK, target, formatStringIndex, 0);
|
||||||
emitLoadK(target, formatStringIndex);
|
emitLoadK(target, formatStringIndex);
|
||||||
|
|
||||||
for (AstExpr* expression : expr->expressions)
|
uint8_t baseExprReg = allocReg(expr, expr->expressions.size);
|
||||||
{
|
|
||||||
uint8_t reg = allocReg(expression, 1);
|
for (size_t index = 0; index < expr->expressions.size; ++index)
|
||||||
compileExpr(expression, reg, targetTemp);
|
compileExpr(expr->expressions.data[index], baseExprReg + index, targetTemp);
|
||||||
}
|
|
||||||
|
|
||||||
BytecodeBuilder::StringRef formatMethod = sref(AstName("format"));
|
BytecodeBuilder::StringRef formatMethod = sref(AstName("format"));
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue