Skip to content

Commit 6f6d139

Browse files
committed
avoid a cyclic deps
1 parent 54e96c0 commit 6f6d139

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

compiler/astmsgs.nim

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# this module avoids ast depending on msgs or vice versa
22
import std/strutils
3-
import options, ast, msgs, types
3+
import options, ast, msgs
44

55
proc typSym*(t: PType): PSym =
66
result = t.sym
@@ -26,10 +26,3 @@ proc addDeclaredLoc*(result: var string, conf: ConfigRef; typ: PType) =
2626

2727
proc addDeclaredLocMaybe*(result: var string, conf: ConfigRef; typ: PType) =
2828
if optDeclaredLocs in conf.globalOptions: addDeclaredLoc(result, conf, typ)
29-
30-
proc addTypeDeclVerboseMaybe*(result: var string, conf: ConfigRef; typ: PType) =
31-
if optDeclaredLocs in conf.globalOptions:
32-
result.add typeToString(typ, preferMixed)
33-
result.addDeclaredLoc(conf, typ)
34-
else:
35-
result.add typeToString(typ)

compiler/types.nim

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
import
1313
intsets, ast, astalgo, trees, msgs, strutils, platform, renderer, options,
14-
lineinfos, int128, modulegraphs
14+
lineinfos, int128, modulegraphs, astmsgs
1515

1616
type
1717
TPreferedDesc* = enum
@@ -51,7 +51,12 @@ type
5151

5252
proc typeToString*(typ: PType; prefer: TPreferedDesc = preferName): string
5353

54-
import astmsgs
54+
proc addTypeDeclVerboseMaybe*(result: var string, conf: ConfigRef; typ: PType) =
55+
if optDeclaredLocs in conf.globalOptions:
56+
result.add typeToString(typ, preferMixed)
57+
result.addDeclaredLoc(conf, typ)
58+
else:
59+
result.add typeToString(typ)
5560

5661
template `$`*(typ: PType): string = typeToString(typ)
5762

0 commit comments

Comments
 (0)