summary refs log tree commit diff stats
path: root/compiler/seminst.nim
diff options
context:
space:
mode:
authorZahary Karadjov <zahary@gmail.com>2013-12-19 01:06:38 +0200
committerZahary Karadjov <zahary@gmail.com>2013-12-19 01:06:38 +0200
commit027f30610e44633b661befcca1b5dd39e9eaa283 (patch)
tree45841cac06bf79c512b050791697ce68b36b58ed /compiler/seminst.nim
parent7120491d055c04d838d9539fdf0c42003637ec2d (diff)
downloadNim-027f30610e44633b661befcca1b5dd39e9eaa283.tar.gz
static params: expr[T] is now static[T]
This introduces tyStatic and successfully bootstraps and handles
few simple test cases.  Static params within macros are no longer
treated as PNimrodNodes - they are now equivalent to constants
of the designated type.
Diffstat (limited to 'compiler/seminst.nim')
-rw-r--r--compiler/seminst.nim8
1 files changed, 4 insertions, 4 deletions
diff --git a/compiler/seminst.nim b/compiler/seminst.nim
index d7d64fd54..a76c673da 100644
--- a/compiler/seminst.nim
+++ b/compiler/seminst.nim
@@ -20,7 +20,7 @@ proc instantiateGenericParamList(c: PContext, n: PNode, pt: TIdTable,
     if a.kind != nkSym: 
       InternalError(a.info, "instantiateGenericParamList; no symbol")
     var q = a.sym
-    if q.typ.kind notin {tyTypeDesc, tyGenericParam, tyExpr}+tyTypeClasses:
+    if q.typ.kind notin {tyTypeDesc, tyGenericParam, tyStatic}+tyTypeClasses:
       continue
     var s = newSym(skType, q.name, getCurrOwner(), q.info)
     s.flags = s.flags + {sfUsed, sfFromGeneric}
@@ -145,11 +145,11 @@ proc lateInstantiateGeneric(c: PContext, invocation: PType, info: TLineInfo): PT
     pushInfoContext(info)
     for i in 0 .. <s.typ.n.sons.len:
       let genericParam = s.typ.n[i].sym
-      let symKind = if genericParam.typ.kind == tyExpr: skConst
+      let symKind = if genericParam.typ.kind == tyStatic: skConst
                     else: skType
 
       var boundSym = newSym(symKind, s.typ.n[i].sym.name, s, info)
-      boundSym.typ = invocation.sons[i+1].skipTypes({tyExpr})
+      boundSym.typ = invocation.sons[i+1].skipTypes({tyStatic})
       boundSym.ast = invocation.sons[i+1].n
       addDecl(c, boundSym)
     # XXX: copyTree would have been unnecessary here if semTypeNode
@@ -200,7 +200,7 @@ proc fixupProcType(c: PContext, genericType: PType,
     result = inst.concreteTypes[genericType.sym.position]
     if tfUnresolved in genericType.flags:
       result = result.sons[0]
-  of tyExpr:
+  of tyStatic:
     result = inst.concreteTypes[genericType.sym.position]
   of tyOpenArray, tyArray, tySet, tySequence, tyTuple, tyProc,
      tyPtr, tyVar, tyRef, tyOrdinal, tyRange, tyVarargs: