JS target improvements
This commit is contained in:
parent
55aa4c2689
commit
b48e178969
2 changed files with 7 additions and 2 deletions
|
|
@ -1648,6 +1648,9 @@ proc genMagic(p: PProc, n: PNode, r: var TCompRes) =
|
||||||
of mChr, mArrToSeq: gen(p, n.sons[1], r) # nothing to do
|
of mChr, mArrToSeq: gen(p, n.sons[1], r) # nothing to do
|
||||||
of mOrd: genOrd(p, n, r)
|
of mOrd: genOrd(p, n, r)
|
||||||
of mLengthStr:
|
of mLengthStr:
|
||||||
|
if p.target == targetJS and n.sons[1].typ.skipTypes(abstractInst).kind == tyCString:
|
||||||
|
unaryExpr(p, n, r, "", "($1 != null ? $1.length : 0)")
|
||||||
|
else:
|
||||||
unaryExpr(p, n, r, "", "($1 != null ? $1.length-1 : 0)" |
|
unaryExpr(p, n, r, "", "($1 != null ? $1.length-1 : 0)" |
|
||||||
"strlen($1)")
|
"strlen($1)")
|
||||||
of mXLenStr: unaryExpr(p, n, r, "", "$1.length-1" | "strlen($1)")
|
of mXLenStr: unaryExpr(p, n, r, "", "$1.length-1" | "strlen($1)")
|
||||||
|
|
|
||||||
|
|
@ -97,6 +97,8 @@ proc rawWriteStackTrace(): string =
|
||||||
else:
|
else:
|
||||||
result = "No stack traceback available\n"
|
result = "No stack traceback available\n"
|
||||||
|
|
||||||
|
proc getStackTrace*(): string = rawWriteStackTrace()
|
||||||
|
|
||||||
proc unhandledException(e: ref Exception) {.
|
proc unhandledException(e: ref Exception) {.
|
||||||
compilerproc, asmNoStackFrame.} =
|
compilerproc, asmNoStackFrame.} =
|
||||||
when NimStackTrace:
|
when NimStackTrace:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue