diff options
author | Clyybber <darkmine956@gmail.com> | 2020-08-28 22:18:09 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-28 22:18:09 +0200 |
commit | 13e659cfec83eb3c2c3c2bbbf10d01ba59bc0d5b (patch) | |
tree | 6df6a9dfc3b5f0ba7f27452c8f84b55a957b73ba /compiler/ast.nim | |
parent | f8c48fc1863a243718acf86b699baed1a5c1512e (diff) | |
download | Nim-13e659cfec83eb3c2c3c2bbbf10d01ba59bc0d5b.tar.gz |
Big compiler Cleanup (#14777)
Diffstat (limited to 'compiler/ast.nim')
-rw-r--r-- | compiler/ast.nim | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/compiler/ast.nim b/compiler/ast.nim index 06ff92e9f..23b564af3 100644 --- a/compiler/ast.nim +++ b/compiler/ast.nim @@ -17,22 +17,21 @@ export int128 type TCallingConvention* = enum - ccNimCall, # nimcall, also the default - ccStdCall, # procedure is stdcall - ccCDecl, # cdecl - ccSafeCall, # safecall - ccSysCall, # system call - ccInline, # proc should be inlined - ccNoInline, # proc should not be inlined - ccFastCall, # fastcall (pass parameters in registers) - ccThisCall, # thiscall (parameters are pushed right-to-left) - ccClosure, # proc has a closure + ccNimCall # nimcall, also the default + ccStdCall # procedure is stdcall + ccCDecl # cdecl + ccSafeCall # safecall + ccSysCall # system call + ccInline # proc should be inlined + ccNoInline # proc should not be inlined + ccFastCall # fastcall (pass parameters in registers) + ccThisCall # thiscall (parameters are pushed right-to-left) + ccClosure # proc has a closure ccNoConvention # needed for generating proper C procs sometimes -const - CallingConvToStr*: array[TCallingConvention, string] = ["nimcall", "stdcall", - "cdecl", "safecall", "syscall", "inline", "noinline", "fastcall", "thiscall", - "closure", "noconv"] +const CallingConvToStr*: array[TCallingConvention, string] = ["nimcall", "stdcall", + "cdecl", "safecall", "syscall", "inline", "noinline", "fastcall", "thiscall", + "closure", "noconv"] type TNodeKind* = enum # order is extremely important, because ranges are used @@ -1363,7 +1362,7 @@ proc newType*(kind: TTypeKind, owner: PSym): PType = proc mergeLoc(a: var TLoc, b: TLoc) = if a.k == low(a.k): a.k = b.k if a.storage == low(a.storage): a.storage = b.storage - a.flags = a.flags + b.flags + a.flags.incl b.flags if a.lode == nil: a.lode = b.lode if a.r == nil: a.r = b.r @@ -1388,7 +1387,7 @@ proc assignType*(dest, src: PType) = # this fixes 'type TLock = TSysLock': if src.sym != nil: if dest.sym != nil: - dest.sym.flags = dest.sym.flags + (src.sym.flags-{sfExported}) + dest.sym.flags.incl src.sym.flags-{sfExported} if dest.sym.annex == nil: dest.sym.annex = src.sym.annex mergeLoc(dest.sym.loc, src.sym.loc) else: @@ -1495,8 +1494,7 @@ proc isGCedMem*(t: PType): bool {.inline.} = t.kind == tyProc and t.callConv == ccClosure proc propagateToOwner*(owner, elem: PType; propagateHasAsgn = true) = - const HaveTheirOwnEmpty = {tySequence, tySet, tyPtr, tyRef, tyProc} - owner.flags = owner.flags + (elem.flags * {tfHasMeta, tfTriggersCompileTime}) + owner.flags.incl elem.flags * {tfHasMeta, tfTriggersCompileTime} if tfNotNil in elem.flags: if owner.kind in {tyGenericInst, tyGenericBody, tyGenericInvocation}: owner.flags.incl tfNotNil |