mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-03 11:42:33 +00:00
bugfix: the code gen can now handle alias TLock = TSysLock; this fixes threading bugs
This commit is contained in:
@@ -772,6 +772,14 @@ proc NewType(kind: TTypeKind, owner: PSym): PType =
|
||||
#if result.id < 2000 then
|
||||
# MessageOut(typeKindToStr[kind] & ' has id: ' & toString(result.id))
|
||||
|
||||
proc mergeLoc(a: var TLoc, b: TLoc) =
|
||||
if a.k == low(a.k): a.k = b.k
|
||||
if a.s == low(a.s): a.s = b.s
|
||||
a.flags = a.flags + b.flags
|
||||
if a.t == nil: a.t = b.t
|
||||
if a.r == nil: a.r = b.r
|
||||
if a.a == 0: a.a = b.a
|
||||
|
||||
proc assignType(dest, src: PType) =
|
||||
dest.kind = src.kind
|
||||
dest.flags = src.flags
|
||||
@@ -780,6 +788,14 @@ proc assignType(dest, src: PType) =
|
||||
dest.size = src.size
|
||||
dest.align = src.align
|
||||
dest.containerID = src.containerID
|
||||
# this fixes 'type TLock = TSysLock':
|
||||
if src.sym != nil:
|
||||
if dest.sym != nil:
|
||||
dest.sym.flags = dest.sym.flags + src.sym.flags
|
||||
if dest.sym.annex == nil: dest.sym.annex = src.sym.annex
|
||||
mergeLoc(dest.sym.loc, src.sym.loc)
|
||||
else:
|
||||
dest.sym = src.sym
|
||||
newSons(dest, sonsLen(src))
|
||||
for i in countup(0, sonsLen(src) - 1): dest.sons[i] = src.sons[i]
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ proc CloseScope*(tab: var TSymTab) =
|
||||
var it: TTabIter
|
||||
var s = InitTabIter(it, tab.stack[tab.tos-1])
|
||||
while s != nil:
|
||||
if sfForward in s.flags:
|
||||
if sfForward in s.flags:
|
||||
LocalError(s.info, errImplOfXexpected, getSymRepr(s))
|
||||
elif {sfUsed, sfExported} * s.flags == {} and optHints in s.options:
|
||||
# BUGFIX: check options in s!
|
||||
|
||||
@@ -147,9 +147,6 @@ proc processMagic(c: PContext, n: PNode, s: PSym) =
|
||||
s.magic = m
|
||||
break
|
||||
if s.magic == mNone: Message(n.info, warnUnknownMagic, v)
|
||||
# magics don't need an implementation, so we
|
||||
# treat them as imported, instead of modifing a lot of working code:
|
||||
incl(s.flags, sfImportc)
|
||||
|
||||
proc wordToCallConv(sw: TSpecialWord): TCallingConvention =
|
||||
# this assumes that the order of special words and calling conventions is
|
||||
|
||||
@@ -733,7 +733,8 @@ proc semProcAux(c: PContext, n: PNode, kind: TSymKind,
|
||||
n.sons[bodyPos] = ast.emptyNode
|
||||
else:
|
||||
if proto != nil: LocalError(n.info, errImplOfXexpected, proto.name.s)
|
||||
if {sfImportc, sfBorrow} * s.flags == {}: incl(s.flags, sfForward)
|
||||
if {sfImportc, sfBorrow} * s.flags == {} and s.magic == mNone:
|
||||
incl(s.flags, sfForward)
|
||||
elif sfBorrow in s.flags: semBorrow(c, n, s)
|
||||
sideEffectsCheck(c, s)
|
||||
closeScope(c.tab) # close scope for parameters
|
||||
|
||||
1
todo.txt
1
todo.txt
@@ -2,6 +2,7 @@ version 0.8.14
|
||||
==============
|
||||
|
||||
- GC should care about interior pointers on the stack
|
||||
- BUG: absolute paths in compiler generated scripts
|
||||
- BUG: type TX = TTable[string, int]
|
||||
- warning for implicit openArray -> varargs conversion
|
||||
- implement explicit varargs; **but** ``len(varargs)`` problem remains!
|
||||
|
||||
Reference in New Issue
Block a user