fixes #11727 [backport]

This commit is contained in:
Araq
2019-11-28 10:47:20 +01:00
committed by Andreas Rumpf
parent 87f0d534d6
commit 0996eb174f
3 changed files with 12 additions and 5 deletions

View File

@@ -280,7 +280,7 @@ type
ExceptionGotoUnhandled
proc findExceptionHandler(c: PCtx, f: PStackFrame, exc: PNode):
tuple[why: ExceptionGoto, where: int] =
tuple[why: ExceptionGoto, where: int] =
let raisedType = exc.typ.skipTypes(abstractPtrs)
while f.safePoints.len > 0:
@@ -1345,9 +1345,11 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame): TFullReg =
of opcQuit:
if c.mode in {emRepl, emStaticExpr, emStaticStmt}:
message(c.config, c.debug[pc], hintQuitCalled)
msgQuit(int8(toInt(getOrdValue(regs[ra].regToNode))))
msgQuit(int8(toInt(getOrdValue(regs[ra].regToNode, onError = toInt128(1)))))
else:
return TFullReg(kind: rkNone)
of opcInvalidField:
stackTrace(c, tos, pc, errFieldXNotFound & regs[ra].node.strVal)
of opcSetLenStr:
decodeB(rkNode)
#createStrKeepNode regs[ra]

View File

@@ -74,7 +74,7 @@ type
opcContainsSet, opcRepr, opcSetLenStr, opcSetLenSeq,
opcIsNil, opcOf, opcIs,
opcSubStr, opcParseFloat, opcConv, opcCast,
opcQuit,
opcQuit, opcInvalidField,
opcNarrowS, opcNarrowU,
opcSignExtend,

View File

@@ -1719,8 +1719,13 @@ proc genCheckedObjAccessAux(c: PCtx; n: PNode; dest: var TDest; flags: TGenFlags
# If the check fails let the user know
let lab1 = c.xjmp(n, if negCheck: opcFJmp else: opcTJmp, rs)
c.freeTemp(rs)
# Not ideal but will do for the moment
c.gABC(n, opcQuit)
let strType = getSysType(c.graph, n.info, tyString)
var fieldNameRegister: TDest = c.getTemp(strType)
let strLit = newStrNode($accessExpr[1], accessExpr[1].info)
strLit.typ = strType
c.genLit(strLit, fieldNameRegister)
c.gABC(n, opcInvalidField, fieldNameRegister)
c.freeTemp(fieldNameRegister)
c.patch(lab1)
proc genCheckedObjAccess(c: PCtx; n: PNode; dest: var TDest; flags: TGenFlags) =