Untyped pointers godegen changed. addr expression fixed.

This commit is contained in:
Yuriy Glukhov 2015-08-21 13:29:25 +03:00
commit a5be556a4c
4 changed files with 21 additions and 10 deletions

View file

@ -136,7 +136,7 @@ proc mapType(typ: PType): TJSTypeKind =
result = etyBaseIndex
of tyPointer:
# treat a tyPointer like a typed pointer to an array of bytes
result = etyInt
result = etyBaseIndex
of tyRange, tyDistinct, tyOrdinal, tyConst, tyMutable, tyIter, tyProxy:
result = mapType(t.sons[0])
of tyInt..tyInt64, tyUInt..tyUInt64, tyEnum, tyChar: result = etyInt

View file

@ -13,6 +13,8 @@
proc semAddr(c: PContext; n: PNode; isUnsafeAddr=false): PNode =
result = newNodeI(nkAddr, n.info)
let x = semExprWithType(c, n)
if x.kind == nkSym:
x.sym.flags.incl(sfAddrTaken)
if isAssignable(c, x, isUnsafeAddr) notin {arLValue, arLocalLValue}:
localError(n.info, errExprHasNoAddress)
result.add x