first implementation of overloading of '='; missing: rewriting let/var sections
This commit is contained in:
parent
99e0fb90e0
commit
78f371c03a
12 changed files with 374 additions and 216 deletions
|
|
@ -472,7 +472,7 @@ type
|
|||
# T and I here can bind to both typedesc and static types
|
||||
# before this is determined, we'll consider them to be a
|
||||
# wildcard type.
|
||||
tfGuarded # guarded pointer
|
||||
tfHasAsgn # type has overloaded assignment operator
|
||||
tfBorrowDot # distinct type borrows '.'
|
||||
|
||||
TTypeFlags* = set[TTypeFlag]
|
||||
|
|
@ -805,6 +805,7 @@ type
|
|||
# mean that there is no destructor.
|
||||
# see instantiateDestructor in semdestruct.nim
|
||||
deepCopy*: PSym # overriden 'deepCopy' operation
|
||||
assignment*: PSym # overriden '=' operator
|
||||
size*: BiggestInt # the size of the type in bytes
|
||||
# -1 means that the size is unkwown
|
||||
align*: int16 # the type's alignment requirements
|
||||
|
|
@ -1219,6 +1220,7 @@ proc assignType*(dest, src: PType) =
|
|||
dest.align = src.align
|
||||
dest.destructor = src.destructor
|
||||
dest.deepCopy = src.deepCopy
|
||||
dest.assignment = src.assignment
|
||||
dest.lockLevel = src.lockLevel
|
||||
# this fixes 'type TLock = TSysLock':
|
||||
if src.sym != nil:
|
||||
|
|
@ -1335,6 +1337,13 @@ proc propagateToOwner*(owner, elem: PType) =
|
|||
if elem.isMetaType:
|
||||
owner.flags.incl tfHasMeta
|
||||
|
||||
if tfHasAsgn in elem.flags:
|
||||
let o2 = elem.skipTypes({tyGenericInst})
|
||||
if o2.kind in {tyTuple, tyObject, tyArray, tyArrayConstr,
|
||||
tySequence, tySet, tyDistinct}:
|
||||
o2.flags.incl tfHasAsgn
|
||||
owner.flags.incl tfHasAsgn
|
||||
|
||||
if owner.kind notin {tyProc, tyGenericInst, tyGenericBody,
|
||||
tyGenericInvocation}:
|
||||
let elemB = elem.skipTypes({tyGenericInst})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue