summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--compiler/concepts.nim14
-rw-r--r--compiler/sem.nim10
-rw-r--r--compiler/semdata.nim22
-rw-r--r--compiler/semtypinst.nim2
4 files changed, 22 insertions, 26 deletions
diff --git a/compiler/concepts.nim b/compiler/concepts.nim
index 681e4eace..55088740c 100644
--- a/compiler/concepts.nim
+++ b/compiler/concepts.nim
@@ -13,8 +13,6 @@
 
 import ast, astalgo, semdata, lookups, lineinfos, idents, msgs, renderer, types, intsets
 
-from magicsys import addSonSkipIntLit
-
 when defined(nimPreviewSlimSystem):
   import std/assertions
 
@@ -33,18 +31,6 @@ proc declareSelf(c: PContext; info: TLineInfo) =
   s.typ.add newType(tyEmpty, nextTypeId(c.idgen), ow)
   addDecl(c, s, info)
 
-proc isSelf*(t: PType): bool {.inline.} =
-  ## Is this the magical 'Self' type?
-  t.kind == tyTypeDesc and tfPacked in t.flags
-
-proc makeTypeDesc*(c: PContext, typ: PType): PType =
-  if typ.kind == tyTypeDesc and not isSelf(typ):
-    result = typ
-  else:
-    result = newTypeS(tyTypeDesc, c)
-    incl result.flags, tfCheckedForDestructor
-    result.addSonSkipIntLit(typ, c.idgen)
-
 proc semConceptDecl(c: PContext; n: PNode): PNode =
   ## Recursive helper for semantic checking for the concept declaration.
   ## Currently we only support (possibly empty) lists of statements
diff --git a/compiler/sem.nim b/compiler/sem.nim
index 1a080f869..74045e5cf 100644
--- a/compiler/sem.nim
+++ b/compiler/sem.nim
@@ -329,16 +329,6 @@ proc semTemplateExpr(c: PContext, n: PNode, s: PSym,
 proc semMacroExpr(c: PContext, n, nOrig: PNode, sym: PSym,
                   flags: TExprFlags = {}; expectedType: PType = nil): PNode
 
-proc symFromType(c: PContext; t: PType, info: TLineInfo): PSym =
-  if t.sym != nil: return t.sym
-  result = newSym(skType, getIdent(c.cache, "AnonType"), c.idgen, t.owner, info)
-  result.flags.incl sfAnon
-  result.typ = t
-
-proc symNodeFromType(c: PContext, t: PType, info: TLineInfo): PNode =
-  result = newSymNode(symFromType(c, t, info), info)
-  result.typ = makeTypeDesc(c, t)
-
 when false:
   proc createEvalContext(c: PContext, mode: TEvalMode): PEvalContext =
     result = newEvalContext(c.module, mode)
diff --git a/compiler/semdata.nim b/compiler/semdata.nim
index 00559a5b6..9386c3763 100644
--- a/compiler/semdata.nim
+++ b/compiler/semdata.nim
@@ -551,6 +551,28 @@ proc makeRangeType*(c: PContext; first, last: BiggestInt;
   result.n = n
   addSonSkipIntLit(result, intType, c.idgen) # basetype of range
 
+proc isSelf*(t: PType): bool {.inline.} =
+  ## Is this the magical 'Self' type from concepts?
+  t.kind == tyTypeDesc and tfPacked in t.flags
+
+proc makeTypeDesc*(c: PContext, typ: PType): PType =
+  if typ.kind == tyTypeDesc and not isSelf(typ):
+    result = typ
+  else:
+    result = newTypeS(tyTypeDesc, c)
+    incl result.flags, tfCheckedForDestructor
+    result.addSonSkipIntLit(typ, c.idgen)
+
+proc symFromType*(c: PContext; t: PType, info: TLineInfo): PSym =
+  if t.sym != nil: return t.sym
+  result = newSym(skType, getIdent(c.cache, "AnonType"), c.idgen, t.owner, info)
+  result.flags.incl sfAnon
+  result.typ = t
+
+proc symNodeFromType*(c: PContext, t: PType, info: TLineInfo): PNode =
+  result = newSymNode(symFromType(c, t, info), info)
+  result.typ = makeTypeDesc(c, t)
+
 proc markIndirect*(c: PContext, s: PSym) {.inline.} =
   if s.kind in {skProc, skFunc, skConverter, skMethod, skIterator}:
     incl(s.flags, sfAddrTaken)
diff --git a/compiler/semtypinst.nim b/compiler/semtypinst.nim
index 0157ecd0b..bd2b25c24 100644
--- a/compiler/semtypinst.nim
+++ b/compiler/semtypinst.nim
@@ -12,8 +12,6 @@
 import ast, astalgo, msgs, types, magicsys, semdata, renderer, options,
   lineinfos, modulegraphs
 
-from concepts import makeTypeDesc
-
 when defined(nimPreviewSlimSystem):
   import std/assertions