diff options
author | Araq <rumpf_a@web.de> | 2016-08-27 20:52:26 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2016-08-27 20:52:26 +0200 |
commit | 884d5518dd824ff451caf5689624c824a73520d5 (patch) | |
tree | 1069304c1c36814b413ebd54bf4680c977e1d2df /compiler/seminst.nim | |
parent | 68e30d7d52d84578fbe0f6f1c2041b150251e800 (diff) | |
parent | 7e643d73788fd0799cc970601bc75592e9610039 (diff) | |
download | Nim-884d5518dd824ff451caf5689624c824a73520d5.tar.gz |
Merged
Diffstat (limited to 'compiler/seminst.nim')
-rw-r--r-- | compiler/seminst.nim | 37 |
1 files changed, 4 insertions, 33 deletions
diff --git a/compiler/seminst.nim b/compiler/seminst.nim index 460db4f7c..498ebc3fb 100644 --- a/compiler/seminst.nim +++ b/compiler/seminst.nim @@ -97,22 +97,6 @@ proc genericCacheGet(genericSym: PSym, entry: TInstantiation; if inst.compilesId == id and sameInstantiation(entry, inst[]): return inst.sym -proc removeDefaultParamValues(n: PNode) = - # we remove default params, because they cannot be instantiated properly - # and they are not needed anyway for instantiation (each param is already - # provided). - when false: - for i in countup(1, sonsLen(n)-1): - var a = n.sons[i] - if a.kind != nkIdentDefs: IllFormedAst(a) - var L = a.len - if a.sons[L-1].kind != nkEmpty and a.sons[L-2].kind != nkEmpty: - # ``param: typ = defaultVal``. - # We don't need defaultVal for semantic checking and it's wrong for - # ``cmp: proc (a, b: T): int = cmp``. Hm, for ``cmp = cmp`` that is - # not possible... XXX We don't solve this issue here. - a.sons[L-1] = ast.emptyNode - proc freshGenSyms(n: PNode, owner, orig: PSym, symMap: var TIdTable) = # we need to create a fresh set of gensym'ed symbols: if n.kind == nkSym and sfGenSym in n.sym.flags and n.sym.owner == orig: @@ -128,17 +112,6 @@ proc freshGenSyms(n: PNode, owner, orig: PSym, symMap: var TIdTable) = proc addParamOrResult(c: PContext, param: PSym, kind: TSymKind) -proc addProcDecls(c: PContext, fn: PSym) = - # get the proc itself in scope (e.g. for recursion) - addDecl(c, fn) - - for i in 1 .. <fn.typ.n.len: - var param = fn.typ.n.sons[i].sym - param.owner = fn - addParamOrResult(c, param, fn.kind) - - maybeAddResult(c, fn, fn.ast) - proc instantiateBody(c: PContext, n, params: PNode, result, orig: PSym) = if n.sons[bodyPos].kind != nkEmpty: inc c.inGenericInst @@ -172,9 +145,10 @@ proc fixupInstantiatedSymbols(c: PContext, s: PSym) = popInfoContext() proc sideEffectsCheck(c: PContext, s: PSym) = - if {sfNoSideEffect, sfSideEffect} * s.flags == - {sfNoSideEffect, sfSideEffect}: - localError(s.info, errXhasSideEffects, s.name.s) + when false: + if {sfNoSideEffect, sfSideEffect} * s.flags == + {sfNoSideEffect, sfSideEffect}: + localError(s.info, errXhasSideEffects, s.name.s) proc instGenericContainer(c: PContext, info: TLineInfo, header: PType, allowMetaTypes = false): PType = @@ -187,9 +161,6 @@ proc instGenericContainer(c: PContext, info: TLineInfo, header: PType, cl.allowMetaTypes = allowMetaTypes result = replaceTypeVarsT(cl, header) -proc instGenericContainer(c: PContext, n: PNode, header: PType): PType = - result = instGenericContainer(c, n.info, header) - proc instantiateProcType(c: PContext, pt: TIdTable, prc: PSym, info: TLineInfo) = # XXX: Instantiates a generic proc signature, while at the same |