Untyped pointers godegen changed. addr expression fixed.
This commit is contained in:
parent
0cc662d8b8
commit
a5be556a4c
4 changed files with 21 additions and 10 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue