disable transitive closure computations; only semcheck procs that have the cursor
This commit is contained in:
parent
5ff6ff28bf
commit
733ed91d33
3 changed files with 41 additions and 25 deletions
|
|
@ -73,7 +73,7 @@ proc addDep*(g: ModuleGraph; m: PSym, dep: int32) =
|
||||||
deps.incl m.position.dependsOn(dep)
|
deps.incl m.position.dependsOn(dep)
|
||||||
# we compute the transitive closure later when quering the graph lazily.
|
# we compute the transitive closure later when quering the graph lazily.
|
||||||
# this improve efficiency quite a lot:
|
# this improve efficiency quite a lot:
|
||||||
invalidTransitiveClosure = true
|
#invalidTransitiveClosure = true
|
||||||
|
|
||||||
proc addIncludeDep*(g: ModuleGraph; module, includeFile: int32) =
|
proc addIncludeDep*(g: ModuleGraph; module, includeFile: int32) =
|
||||||
discard hasKeyOrPut(inclToMod, includeFile, module)
|
discard hasKeyOrPut(inclToMod, includeFile, module)
|
||||||
|
|
|
||||||
|
|
@ -1177,11 +1177,22 @@ proc semOverride(c: PContext, s: PSym, n: PNode) =
|
||||||
localError(n.info, errGenerated,
|
localError(n.info, errGenerated,
|
||||||
"'destroy' or 'deepCopy' expected for 'override'")
|
"'destroy' or 'deepCopy' expected for 'override'")
|
||||||
|
|
||||||
|
proc cursorInProcAux(n: PNode): bool =
|
||||||
|
if inCheckpoint(n.info) != cpNone: return true
|
||||||
|
for i in 0..<n.safeLen:
|
||||||
|
if cursorInProcAux(n[i]): return true
|
||||||
|
|
||||||
|
proc cursorInProc(n: PNode): bool =
|
||||||
|
if n.info.fileIndex == gTrackPos.fileIndex:
|
||||||
|
result = cursorInProcAux(n)
|
||||||
|
|
||||||
type
|
type
|
||||||
TProcCompilationSteps = enum
|
TProcCompilationSteps = enum
|
||||||
stepRegisterSymbol,
|
stepRegisterSymbol,
|
||||||
stepDetermineType,
|
stepDetermineType,
|
||||||
|
|
||||||
|
import compilerlog
|
||||||
|
|
||||||
proc semProcAux(c: PContext, n: PNode, kind: TSymKind,
|
proc semProcAux(c: PContext, n: PNode, kind: TSymKind,
|
||||||
validPragmas: TSpecialWords,
|
validPragmas: TSpecialWords,
|
||||||
phase = stepRegisterSymbol): PNode =
|
phase = stepRegisterSymbol): PNode =
|
||||||
|
|
@ -1303,29 +1314,34 @@ proc semProcAux(c: PContext, n: PNode, kind: TSymKind,
|
||||||
# Macros and Templates can have generic parameters, but they are
|
# Macros and Templates can have generic parameters, but they are
|
||||||
# only used for overload resolution (there is no instantiation of
|
# only used for overload resolution (there is no instantiation of
|
||||||
# the symbol, so we must process the body now)
|
# the symbol, so we must process the body now)
|
||||||
pushProcCon(c, s)
|
if not usePseudoGenerics and gIdeCmd in {ideSug, ideCon} and not
|
||||||
if n.sons[genericParamsPos].kind == nkEmpty or usePseudoGenerics:
|
cursorInProc(n.sons[bodyPos]):
|
||||||
if not usePseudoGenerics: paramsTypeCheck(c, s.typ)
|
discard "speed up nimsuggest"
|
||||||
|
logStr "skipped " & s.name.s
|
||||||
c.p.wasForwarded = proto != nil
|
|
||||||
maybeAddResult(c, s, n)
|
|
||||||
if lfDynamicLib notin s.loc.flags:
|
|
||||||
# no semantic checking for importc:
|
|
||||||
let semBody = hloBody(c, semProcBody(c, n.sons[bodyPos]))
|
|
||||||
# unfortunately we cannot skip this step when in 'system.compiles'
|
|
||||||
# context as it may even be evaluated in 'system.compiles':
|
|
||||||
n.sons[bodyPos] = transformBody(c.module, semBody, s)
|
|
||||||
else:
|
else:
|
||||||
if s.typ.sons[0] != nil and kind != skIterator:
|
pushProcCon(c, s)
|
||||||
addDecl(c, newSym(skUnknown, getIdent"result", nil, n.info))
|
if n.sons[genericParamsPos].kind == nkEmpty or usePseudoGenerics:
|
||||||
openScope(c)
|
if not usePseudoGenerics: paramsTypeCheck(c, s.typ)
|
||||||
n.sons[bodyPos] = semGenericStmt(c, n.sons[bodyPos])
|
|
||||||
closeScope(c)
|
c.p.wasForwarded = proto != nil
|
||||||
fixupInstantiatedSymbols(c, s)
|
maybeAddResult(c, s, n)
|
||||||
if sfImportc in s.flags:
|
if lfDynamicLib notin s.loc.flags:
|
||||||
# so we just ignore the body after semantic checking for importc:
|
# no semantic checking for importc:
|
||||||
n.sons[bodyPos] = ast.emptyNode
|
let semBody = hloBody(c, semProcBody(c, n.sons[bodyPos]))
|
||||||
popProcCon(c)
|
# unfortunately we cannot skip this step when in 'system.compiles'
|
||||||
|
# context as it may even be evaluated in 'system.compiles':
|
||||||
|
n.sons[bodyPos] = transformBody(c.module, semBody, s)
|
||||||
|
else:
|
||||||
|
if s.typ.sons[0] != nil and kind != skIterator:
|
||||||
|
addDecl(c, newSym(skUnknown, getIdent"result", nil, n.info))
|
||||||
|
openScope(c)
|
||||||
|
n.sons[bodyPos] = semGenericStmt(c, n.sons[bodyPos])
|
||||||
|
closeScope(c)
|
||||||
|
fixupInstantiatedSymbols(c, s)
|
||||||
|
if sfImportc in s.flags:
|
||||||
|
# so we just ignore the body after semantic checking for importc:
|
||||||
|
n.sons[bodyPos] = ast.emptyNode
|
||||||
|
popProcCon(c)
|
||||||
else:
|
else:
|
||||||
if proto != nil: localError(n.info, errImplOfXexpected, proto.name.s)
|
if proto != nil: localError(n.info, errImplOfXexpected, proto.name.s)
|
||||||
if {sfImportc, sfBorrow} * s.flags == {} and s.magic == mNone:
|
if {sfImportc, sfBorrow} * s.flags == {} and s.magic == mNone:
|
||||||
|
|
|
||||||
|
|
@ -297,10 +297,10 @@ proc suggestFieldAccess(c: PContext, n: PNode, outputs: var int) =
|
||||||
suggestOperations(c, n, typ, outputs)
|
suggestOperations(c, n, typ, outputs)
|
||||||
|
|
||||||
type
|
type
|
||||||
TCheckPointResult = enum
|
TCheckPointResult* = enum
|
||||||
cpNone, cpFuzzy, cpExact
|
cpNone, cpFuzzy, cpExact
|
||||||
|
|
||||||
proc inCheckpoint(current: TLineInfo): TCheckPointResult =
|
proc inCheckpoint*(current: TLineInfo): TCheckPointResult =
|
||||||
if current.fileIndex == gTrackPos.fileIndex:
|
if current.fileIndex == gTrackPos.fileIndex:
|
||||||
if current.line == gTrackPos.line and
|
if current.line == gTrackPos.line and
|
||||||
abs(current.col-gTrackPos.col) < 4:
|
abs(current.col-gTrackPos.col) < 4:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue