diff options
author | Araq <rumpf_a@web.de> | 2013-08-08 21:11:20 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2013-08-08 21:11:20 +0200 |
commit | a294d45fd67cebec8dd0efc43417fdc2ad1030dc (patch) | |
tree | b8626e797eb9e638d32de780f3c4cb2ac1cfeb73 /compiler | |
parent | 288cd05f89009b7432a0e95fec0b1cf78c4ea7e5 (diff) | |
parent | 5dfc0d0d19c122ac88bc421c1130a6030c253ae8 (diff) | |
download | Nim-a294d45fd67cebec8dd0efc43417fdc2ad1030dc.tar.gz |
Merge branch 'master' of github.com:Araq/Nimrod
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/main.nim | 6 | ||||
-rw-r--r-- | compiler/msgs.nim | 6 | ||||
-rw-r--r-- | compiler/suggest.nim | 10 |
3 files changed, 17 insertions, 5 deletions
diff --git a/compiler/main.nim b/compiler/main.nim index 6df21f660..7cfc6d406 100644 --- a/compiler/main.nim +++ b/compiler/main.nim @@ -210,7 +210,11 @@ proc CommandSuggest = msgs.gErrorMax = high(int) # do not stop after first error semanticPasses() rodPass() - compileProject() + # XXX: this handles the case when the dirty buffer is the main file, + # but doesn't handle the case when it's imported module + var projFile = if gProjectMainIdx == gDirtyOriginalIdx: gDirtyBufferIdx + else: gProjectMainIdx + compileProject(projFile) proc wantMainModule = if gProjectFull.len == 0: diff --git a/compiler/msgs.nim b/compiler/msgs.nim index 711a3c733..73481940c 100644 --- a/compiler/msgs.nim +++ b/compiler/msgs.nim @@ -413,7 +413,7 @@ type TFileInfo*{.final.} = object fullPath*: string # This is a canonical full filesystem path projPath*: string # This is relative to the project's root - + shortName*: string # short name of the module quotedName*: PRope # cached quoted short name for codegen # purpoes @@ -473,7 +473,9 @@ proc newFileInfo(fullPath, projPath: string): TFileInfo = #shallow(result.fullPath) result.projPath = projPath #shallow(result.projPath) - result.quotedName = projPath.extractFilename.makeCString + let fileName = projPath.extractFilename + result.shortName = fileName.changeFileExt("") + result.quotedName = fileName.makeCString if optEmbedOrigSrc in gGlobalOptions or true: result.lines = @[] diff --git a/compiler/suggest.nim b/compiler/suggest.nim index 57e373fd5..76a6c21d9 100644 --- a/compiler/suggest.nim +++ b/compiler/suggest.nim @@ -22,6 +22,12 @@ const #template sectionSuggest(): expr = "##begin\n" & getStackTrace() & "##end\n" +proc origModuleName(m: PSym): string = + result = if m.position == gDirtyBufferIdx: + fileInfos[gDirtyOriginalIdx].shortName + else: + m.name.s + proc SymToStr(s: PSym, isLocal: bool, section: string, li: TLineInfo): string = result = section result.add(sep) @@ -31,9 +37,9 @@ proc SymToStr(s: PSym, isLocal: bool, section: string, li: TLineInfo): string = let ow = s.owner if ow.kind != skModule and ow.owner != nil: let ow2 = ow.owner - result.add(ow2.name.s) + result.add(ow2.origModuleName) result.add('.') - result.add(ow.name.s) + result.add(ow.origModuleName) result.add('.') result.add(s.name.s) result.add(sep) |