feat: outofboundserror message includes given bad value
This commit is contained in:
@@ -108,7 +108,7 @@ object RuntimeError {
|
||||
|
||||
def generateHandler: Chain[AsmLine] = Chain(
|
||||
LabelDef(OutOfBoundsError.errLabel),
|
||||
Pop(RSI),
|
||||
Move(RSI, Register(Q64, CX)),
|
||||
stackAlign,
|
||||
Load(RDI, IndexAddress(RIP, LabelArg(OutOfBoundsError.strLabel))),
|
||||
assemblyIR.Call(CLibFunc.PrintF),
|
||||
|
||||
@@ -191,8 +191,10 @@ object asmGenerator {
|
||||
case ArrayElem(x, i) =>
|
||||
chain ++= evalExprOntoStack(rhs)
|
||||
chain ++= evalExprOntoStack(i)
|
||||
chain += Compare(stack.head, ImmediateVal(0))
|
||||
chain += stack.pop(RCX)
|
||||
chain += Compare(ECX, ImmediateVal(0))
|
||||
chain += Jump(LabelArg(OutOfBoundsError.errLabel), Cond.Less)
|
||||
chain += stack.push(Q64, RCX)
|
||||
chain ++= evalExprOntoStack(x)
|
||||
chain += stack.pop(RAX)
|
||||
chain += stack.pop(RCX)
|
||||
|
||||
Reference in New Issue
Block a user