nimfix improvements

This commit is contained in:
Araq 2014-09-10 20:34:33 +02:00
commit 22fb9db845
5 changed files with 6 additions and 8 deletions

View file

@ -60,7 +60,7 @@ const
quick quick
release debug release debug
useWinAnsi useFork useNimRtl useMalloc useRealtimeGC ssl memProfiler useWinAnsi useFork useNimRtl useMalloc useRealtimeGC ssl memProfiler
nodejs kwin nodejs kwin nimfix
usesysassert usegcassert tinyC useFFI usesysassert usegcassert tinyC useFFI
useStdoutAsStdmsg createNimRtl useStdoutAsStdmsg createNimRtl

View file

@ -137,4 +137,4 @@ proc styleCheckUse*(info: TLineInfo; s: PSym) =
var x = line.substr(0, first-1) & newName & line.substr(last+1) var x = line.substr(0, first-1) & newName & line.substr(last+1)
system.shallowCopy(gSourceFiles[info.fileIndex].lines[info.line-1], x) system.shallowCopy(gSourceFiles[info.fileIndex].lines[info.line-1], x)
gSourceFiles[info.fileIndex].dirty = true gSourceFiles[info.fileIndex].dirty = true
if newName == "File": writeStackTrace() #if newName == "File": writeStackTrace()

View file

@ -74,7 +74,7 @@ proc replaceDeprecated*(info: TLineInfo; oldSym, newSym: PIdent) =
var x = line.substr(0, first-1) & newSym.s & line.substr(last+1) var x = line.substr(0, first-1) & newSym.s & line.substr(last+1)
system.shallowCopy(gSourceFiles[info.fileIndex].lines[info.line-1], x) system.shallowCopy(gSourceFiles[info.fileIndex].lines[info.line-1], x)
gSourceFiles[info.fileIndex].dirty = true gSourceFiles[info.fileIndex].dirty = true
if newSym.s == "File": writeStackTrace() #if newSym.s == "File": writeStackTrace()
proc replaceDeprecated*(info: TLineInfo; oldSym, newSym: PSym) = proc replaceDeprecated*(info: TLineInfo; oldSym, newSym: PSym) =
replaceDeprecated(info, oldSym.name, newSym.name) replaceDeprecated(info, oldSym.name, newSym.name)

View file

@ -1059,7 +1059,7 @@ proc builtinFieldAccess(c: PContext, n: PNode, flags: TExprFlags): PNode =
f = getSymFromList(ty.n, i) f = getSymFromList(ty.n, i)
if f != nil: if f != nil:
markUsed(n.sons[1].info, f) markUsed(n.sons[1].info, f)
styleCheckUse(n.sons[1].info, s) styleCheckUse(n.sons[1].info, f)
n.sons[0] = makeDeref(n.sons[0]) n.sons[0] = makeDeref(n.sons[0])
n.sons[1] = newSymNode(f) n.sons[1] = newSymNode(f)
n.typ = f.typ n.typ = f.typ

View file

@ -191,6 +191,8 @@ proc addLocalDecl(c: var TemplCtx, n: var PNode, k: TSymKind) =
proc semTemplSymbol(c: PContext, n: PNode, s: PSym): PNode = proc semTemplSymbol(c: PContext, n: PNode, s: PSym): PNode =
incl(s.flags, sfUsed) incl(s.flags, sfUsed)
# we do not call styleCheckUse here, as the identifier is not really
# resolved here. We will fixup the used identifiers later.
case s.kind case s.kind
of skUnknown: of skUnknown:
# Introduced in this pass! Leave it as an identifier. # Introduced in this pass! Leave it as an identifier.
@ -199,19 +201,15 @@ proc semTemplSymbol(c: PContext, n: PNode, s: PSym): PNode =
result = symChoice(c, n, s, scOpen) result = symChoice(c, n, s, scOpen)
of skGenericParam: of skGenericParam:
result = newSymNodeTypeDesc(s, n.info) result = newSymNodeTypeDesc(s, n.info)
styleCheckUse(n.info, s)
of skParam: of skParam:
result = n result = n
styleCheckUse(n.info, s)
of skType: of skType:
if (s.typ != nil) and (s.typ.kind != tyGenericParam): if (s.typ != nil) and (s.typ.kind != tyGenericParam):
result = newSymNodeTypeDesc(s, n.info) result = newSymNodeTypeDesc(s, n.info)
else: else:
result = n result = n
styleCheckUse(n.info, s)
else: else:
result = newSymNode(s, n.info) result = newSymNode(s, n.info)
styleCheckUse(n.info, s)
proc semRoutineInTemplName(c: var TemplCtx, n: PNode): PNode = proc semRoutineInTemplName(c: var TemplCtx, n: PNode): PNode =
result = n result = n