Skip to content

Commit

Permalink
rename: magic => legacyRelProj
Browse files Browse the repository at this point in the history
  • Loading branch information
timotheecour committed Apr 20, 2021
1 parent 28f93b1 commit 1a1ea72
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
8 changes: 4 additions & 4 deletions compiler/commands.nim
Original file line number Diff line number Diff line change
Expand Up @@ -898,11 +898,11 @@ proc processSwitch*(switch, arg: string, pass: TCmdLinePass, info: TLineInfo;
case arg.normalize
of "abs": conf.filenameOption = foAbs
of "canonical": conf.filenameOption = foCanonical
of "magic": conf.filenameOption = foMagicSauce
else: localError(conf, info, "expected: abs|canonical|magic, got: $1" % arg)
of "legacyrelproj": conf.filenameOption = foLegacyRelProj
else: localError(conf, info, "expected: abs|canonical|legacyRelProj, got: $1" % arg)
of "listfullpaths":
conf.filenameOption = if switchOn(arg): foAbs else: foMagicSauce
# xxx in future work, s/foMagicSauce/foCanonical/ here
# xxx in future work, use `warningDeprecated`
conf.filenameOption = if switchOn(arg): foAbs else: foCanonical
of "spellsuggest":
if arg.len == 0: conf.spellSuggestMax = spellSuggestSecretSauce
elif arg == "auto": conf.spellSuggestMax = spellSuggestSecretSauce
Expand Down
3 changes: 2 additions & 1 deletion compiler/msgs.nim
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ proc toFilenameOption*(conf: ConfigRef, fileIdx: FileIndex, opt: FilenameOption)
let absPath = toFullPath(conf, fileIdx)
result = canonicalImportAux(conf, absPath.AbsoluteFile)
of foName: result = toProjPath(conf, fileIdx).lastPathPart
of foMagicSauce:
of foLegacyRelProj:
let
absPath = toFullPath(conf, fileIdx)
relPath = toProjPath(conf, fileIdx)
Expand Down Expand Up @@ -543,6 +543,7 @@ proc liMessage*(conf: ConfigRef; info: TLineInfo, msg: TMsgKind, arg: string,
if conf.hasHint(hintSource) and info != unknownLineInfo:
conf.writeSurroundingSrc(info)
if hintMsgOrigin in conf.mainPackageNotes:
# xxx needs a bit of refactoring to honor `conf.filenameOption`
styledMsgWriteln(styleBright, toFileLineCol(info2), resetStyle,
" compiler msg initiated here", KindColor,
KindFormat % $hintMsgOrigin,
Expand Down
2 changes: 1 addition & 1 deletion compiler/options.nim
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ type
foAbs # absolute path, e.g.: /pathto/bar/foo.nim
foRelProject # relative to project path, e.g.: ../foo.nim
foCanonical # canonical module name
foMagicSauce # magic sauce, shortest of (foAbs, foRelProject)
foLegacyRelProj # legacy, shortest of (foAbs, foRelProject)
foName # lastPathPart, e.g.: foo.nim
foStacktrace # if optExcessiveStackTrace: foAbs else: foName

Expand Down
2 changes: 1 addition & 1 deletion doc/advopt.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Advanced options:
to after all options have been processed
--stdout:on|off output to stdout
--colors:on|off turn compiler messages coloring on|off
--filenames:abs|canonical|magic
--filenames:abs|canonical|legacyRelProj
customize how filenames are rendered in compiler messages,
defaults to `abs` (absolute)
--declaredLocs:on|off show declaration locations in messages
Expand Down
2 changes: 1 addition & 1 deletion tests/config.nims
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ switch("path", "$lib/../testament/lib")
## prevent common user config settings to interfere with testament expectations
## Indifidual tests can override this if needed to test for these options.
switch("colors", "off")
switch("filenames", "magic")
switch("filenames", "legacyRelProj")
switch("excessiveStackTrace", "off")
switch("spellSuggest", "0")

Expand Down

0 comments on commit 1a1ea72

Please sign in to comment.