diff options
author | Araq <rumpf_a@web.de> | 2013-05-27 23:17:48 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2013-05-27 23:17:48 +0200 |
commit | 9c45e33d8c8b1a5f5fca69a467fda87b9b547057 (patch) | |
tree | d404952f36be4a51dee51111212588b359b76e50 | |
parent | d11cf5d1915d83159094f5074a6e17a72c65d9fa (diff) | |
download | Nim-9c45e33d8c8b1a5f5fca69a467fda87b9b547057.tar.gz |
Revert "fix threading tests"
This reverts commit d5fffc032f2b390abd7b4c4fea2e49b1a0ef9736.
-rw-r--r-- | compiler/semexprs.nim | 2 | ||||
-rw-r--r-- | compiler/seminst.nim | 24 |
2 files changed, 9 insertions, 17 deletions
diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim index daad93a85..e07821d1f 100644 --- a/compiler/semexprs.nim +++ b/compiler/semexprs.nim @@ -1769,7 +1769,7 @@ proc semExpr(c: PContext, n: PNode, flags: TExprFlags = {}): PNode = of nkBind: Message(n.info, warnDeprecated, "bind") result = semExpr(c, n.sons[0], flags) - of nkTypeOfExpr, nkTupleTy, nkRefTy..nkEnumTy: + of nkTypeOfExpr: var typ = semTypeNode(c, n, nil).skipTypes({tyTypeDesc}) result = symNodeFromType(c, typ, n.info) of nkCall, nkInfix, nkPrefix, nkPostfix, nkCommand, nkCallStrLit: diff --git a/compiler/seminst.nim b/compiler/seminst.nim index 98f25efa7..431635b9c 100644 --- a/compiler/seminst.nim +++ b/compiler/seminst.nim @@ -165,35 +165,28 @@ proc fixupProcTypeR(c: PContext, genericType: PType, of tyOpenArray, tyArray, tySet, tySequence, tyTuple, tyProc, tyPtr, tyVar, tyRef, tyOrdinal, tyRange, tyVarargs: if genericType.sons == nil: return - var head = 0 for i in 0 .. <genericType.sons.len: let changed = fixupProcTypeR(c, genericType.sons[i], inst) if changed != genericType.sons[i]: if result == genericType: # the first detected change initializes the result - result = copyType(genericType, genericType.owner, false) + result = copyType(genericType, genericType.owner, true) if genericType.n != nil: result.n = copyTree(genericType.n) - if changed.kind == tyEmpty: - result.sons[i..i] = [] - if result.n != nil: result.n.sons[i..i] = [] - continue - let changed = changed.skipIntLit - result.sons[head] = changed + result.sons[i] = changed if result.n != nil: if result.n.kind == nkRecList: - result.n.sons[head].typ = changed + result.n.sons[i].typ = changed if result.n.kind == nkFormalParams: if i == 0: nil else: - let origParam = result.n.sons[head].sym + let origParam = result.n.sons[i].sym var param = copySym(origParam) param.typ = changed param.ast = origParam.ast - result.n.sons[head] = newSymNode(param) - inc head - + result.n.sons[i] = newSymNode(param) + of tyGenericInvokation: result = newTypeWithSons(c, tyGenericInvokation, genericType.sons) for i in 1 .. <genericType.sons.len: @@ -205,10 +198,9 @@ proc fixupProcTypeR(c: PContext, genericType: PType, proc fixupProcType(c: PContext, genericType: PType, inst: TInstantiation): PType = result = copyType(genericType, genericType.owner, false) - result = fixupProcTypeR(c, result, inst) for i in 0 .. <result.sons.len: result.sons[i] = fixupProcTypeR(c, result.sons[i], inst) - + proc generateInstance(c: PContext, fn: PSym, pt: TIdTable, info: TLineInfo): PSym = # no need to instantiate generic templates/macros: @@ -238,7 +230,7 @@ proc generateInstance(c: PContext, fn: PSym, pt: TIdTable, var entry = TInstantiation.new entry.sym = result instantiateGenericParamList(c, n.sons[genericParamsPos], pt, entry[]) - result.typ = fixupProcTypeR(c, fn.typ, entry[]) + result.typ = fixupProcType(c, fn.typ, entry[]) n.sons[genericParamsPos] = ast.emptyNode var oldPrc = GenericCacheGet(fn, entry[]) if oldPrc == nil: |