diff options
-rw-r--r-- | compiler/jsgen.nim | 2 | ||||
-rw-r--r-- | lib/system.nim | 2 | ||||
-rw-r--r-- | lib/system/jssys.nim | 5 |
3 files changed, 6 insertions, 3 deletions
diff --git a/compiler/jsgen.nim b/compiler/jsgen.nim index ea58bb7dd..964752c16 100644 --- a/compiler/jsgen.nim +++ b/compiler/jsgen.nim @@ -981,7 +981,7 @@ proc genArrayAccess(p: PProc, n: PNode, r: var TCompRes) = r.res = "nimAt($1, $2)" % [r.address, r.res] elif ty.kind in {tyString, tyCString}: # XXX this needs to be more like substr($1,$2) - r.res = "ord($1[$2])" % [r.address, r.res] + r.res = "ord(@$1[$2])" % [r.address, r.res] else: r.res = "$1[$2]" % [r.address, r.res] else: diff --git a/lib/system.nim b/lib/system.nim index 5d6fcf868..f584f7590 100644 --- a/lib/system.nim +++ b/lib/system.nim @@ -2163,7 +2163,7 @@ proc `&` *[T](x: T, y: seq[T]): seq[T] {.noSideEffect.} = result[i+1] = y[i] when not defined(nimscript): - when not defined(JS): + when not defined(JS) or defined(nimphp): proc seqToPtr[T](x: seq[T]): pointer {.inline, nosideeffect.} = result = cast[pointer](x) else: diff --git a/lib/system/jssys.nim b/lib/system/jssys.nim index 220683717..99997efe6 100644 --- a/lib/system/jssys.nim +++ b/lib/system/jssys.nim @@ -121,7 +121,10 @@ proc raiseException(e: ref Exception, ename: cstring) {. when not defined(noUnhandledHandler): if excHandler == 0: unhandledException(e) - asm "throw `e`;" + when defined(nimphp): + asm """throw new Exception($`e`["message"]);""" + else: + asm "throw `e`;" proc reraiseException() {.compilerproc, asmNoStackFrame.} = if lastJSError == nil: |