remove nosinks hacks from compiler (#21469)
This commit is contained in:
parent
6994e1b1d7
commit
d950e5f3a8
9 changed files with 13 additions and 13 deletions
|
|
@ -1940,7 +1940,7 @@ template injectG() {.dirty.} =
|
||||||
graph.backend = newModuleList(graph)
|
graph.backend = newModuleList(graph)
|
||||||
let g = BModuleList(graph.backend)
|
let g = BModuleList(graph.backend)
|
||||||
|
|
||||||
proc setupCgen*(graph: ModuleGraph; module: PSym; idgen: IdGenerator): PPassContext {.nosinks.} =
|
proc setupCgen*(graph: ModuleGraph; module: PSym; idgen: IdGenerator): PPassContext =
|
||||||
injectG()
|
injectG()
|
||||||
result = newModule(g, module, graph.config)
|
result = newModule(g, module, graph.config)
|
||||||
result.idgen = idgen
|
result.idgen = idgen
|
||||||
|
|
|
||||||
|
|
@ -100,7 +100,7 @@ proc generateDot*(graph: ModuleGraph; project: AbsoluteFile) =
|
||||||
rope(project.splitFile.name), b.dotGraph],
|
rope(project.splitFile.name), b.dotGraph],
|
||||||
changeFileExt(project, "dot"))
|
changeFileExt(project, "dot"))
|
||||||
|
|
||||||
proc setupDependPass*(graph: ModuleGraph; module: PSym; idgen: IdGenerator): PPassContext {.nosinks.} =
|
proc setupDependPass*(graph: ModuleGraph; module: PSym; idgen: IdGenerator): PPassContext =
|
||||||
var g: PGen
|
var g: PGen
|
||||||
new(g)
|
new(g)
|
||||||
g.module = module
|
g.module = module
|
||||||
|
|
|
||||||
|
|
@ -241,14 +241,14 @@ proc compileProject*(graph: ModuleGraph; projectFileIdx = InvalidFileIdx) =
|
||||||
graph.compileSystemModule()
|
graph.compileSystemModule()
|
||||||
discard graph.compileModule(projectFile, {sfMainModule})
|
discard graph.compileModule(projectFile, {sfMainModule})
|
||||||
|
|
||||||
proc mySemOpen(graph: ModuleGraph; module: PSym; idgen: IdGenerator): PPassContext {.nosinks.} =
|
proc mySemOpen(graph: ModuleGraph; module: PSym; idgen: IdGenerator): PPassContext =
|
||||||
result = preparePContext(graph, module, idgen)
|
result = preparePContext(graph, module, idgen)
|
||||||
|
|
||||||
proc mySemClose(graph: ModuleGraph; context: PPassContext, n: PNode): PNode =
|
proc mySemClose(graph: ModuleGraph; context: PPassContext, n: PNode): PNode =
|
||||||
var c = PContext(context)
|
var c = PContext(context)
|
||||||
closePContext(graph, c, n)
|
closePContext(graph, c, n)
|
||||||
|
|
||||||
proc mySemProcess(context: PPassContext, n: PNode): PNode {.nosinks.} =
|
proc mySemProcess(context: PPassContext, n: PNode): PNode =
|
||||||
result = semWithPContext(PContext(context), n)
|
result = semWithPContext(PContext(context), n)
|
||||||
|
|
||||||
const semPass* = makePass(mySemOpen, mySemProcess, mySemClose,
|
const semPass* = makePass(mySemOpen, mySemProcess, mySemClose,
|
||||||
|
|
|
||||||
|
|
@ -666,7 +666,7 @@ proc addCodeForGenerics(c: PContext, n: PNode) =
|
||||||
n.add prc.ast
|
n.add prc.ast
|
||||||
c.lastGenericIdx = c.generics.len
|
c.lastGenericIdx = c.generics.len
|
||||||
|
|
||||||
proc preparePContext*(graph: ModuleGraph; module: PSym; idgen: IdGenerator): PContext {.nosinks.} =
|
proc preparePContext*(graph: ModuleGraph; module: PSym; idgen: IdGenerator): PContext =
|
||||||
result = newContext(graph, module)
|
result = newContext(graph, module)
|
||||||
result.idgen = idgen
|
result.idgen = idgen
|
||||||
result.enforceVoidContext = newType(tyTyped, nextTypeId(idgen), nil)
|
result.enforceVoidContext = newType(tyTyped, nextTypeId(idgen), nil)
|
||||||
|
|
@ -770,7 +770,7 @@ proc recoverContext(c: PContext) =
|
||||||
while getCurrOwner(c).kind != skModule: popOwner(c)
|
while getCurrOwner(c).kind != skModule: popOwner(c)
|
||||||
while c.p != nil and c.p.owner.kind != skModule: c.p = c.p.next
|
while c.p != nil and c.p.owner.kind != skModule: c.p = c.p.next
|
||||||
|
|
||||||
proc semWithPContext*(c: PContext, n: PNode): PNode {.nosinks.} =
|
proc semWithPContext*(c: PContext, n: PNode): PNode =
|
||||||
# no need for an expensive 'try' if we stop after the first error anyway:
|
# no need for an expensive 'try' if we stop after the first error anyway:
|
||||||
if c.config.errorMax <= 1:
|
if c.config.errorMax <= 1:
|
||||||
result = semStmtAndGenerateGenerics(c, n)
|
result = semStmtAndGenerateGenerics(c, n)
|
||||||
|
|
|
||||||
|
|
@ -601,7 +601,7 @@ proc tryDeref(n: PNode): PNode =
|
||||||
result.add n
|
result.add n
|
||||||
|
|
||||||
proc semOverloadedCall(c: PContext, n, nOrig: PNode,
|
proc semOverloadedCall(c: PContext, n, nOrig: PNode,
|
||||||
filter: TSymKinds, flags: TExprFlags): PNode {.nosinks.} =
|
filter: TSymKinds, flags: TExprFlags): PNode =
|
||||||
var errors: CandidateErrors = @[] # if efExplain in flags: @[] else: nil
|
var errors: CandidateErrors = @[] # if efExplain in flags: @[] else: nil
|
||||||
var r = resolveOverloads(c, n, nOrig, filter, flags, errors, efExplain in flags)
|
var r = resolveOverloads(c, n, nOrig, filter, flags, errors, efExplain in flags)
|
||||||
if r.state == csMatch:
|
if r.state == csMatch:
|
||||||
|
|
|
||||||
|
|
@ -314,7 +314,7 @@ proc fillMixinScope(c: PContext) =
|
||||||
p = p.next
|
p = p.next
|
||||||
|
|
||||||
proc generateInstance(c: PContext, fn: PSym, pt: TIdTable,
|
proc generateInstance(c: PContext, fn: PSym, pt: TIdTable,
|
||||||
info: TLineInfo): PSym {.nosinks.} =
|
info: TLineInfo): PSym =
|
||||||
## Generates a new instance of a generic procedure.
|
## Generates a new instance of a generic procedure.
|
||||||
## The `pt` parameter is a type-unsafe mapping table used to link generic
|
## The `pt` parameter is a type-unsafe mapping table used to link generic
|
||||||
## parameters to their concrete types within the generic instance.
|
## parameters to their concrete types within the generic instance.
|
||||||
|
|
|
||||||
|
|
@ -1692,7 +1692,7 @@ proc semProcAnnotation(c: PContext, prc: PNode;
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
proc semInferredLambda(c: PContext, pt: TIdTable, n: PNode): PNode {.nosinks.} =
|
proc semInferredLambda(c: PContext, pt: TIdTable, n: PNode): PNode =
|
||||||
## used for resolving 'auto' in lambdas based on their callsite
|
## used for resolving 'auto' in lambdas based on their callsite
|
||||||
var n = n
|
var n = n
|
||||||
let original = n[namePos].sym
|
let original = n[namePos].sym
|
||||||
|
|
|
||||||
|
|
@ -2674,7 +2674,7 @@ proc argtypeMatches*(c: PContext, f, a: PType, fromHlo = false): bool =
|
||||||
|
|
||||||
|
|
||||||
proc instTypeBoundOp*(c: PContext; dc: PSym; t: PType; info: TLineInfo;
|
proc instTypeBoundOp*(c: PContext; dc: PSym; t: PType; info: TLineInfo;
|
||||||
op: TTypeAttachedOp; col: int): PSym {.nosinks.} =
|
op: TTypeAttachedOp; col: int): PSym =
|
||||||
var m = newCandidate(c, dc.typ)
|
var m = newCandidate(c, dc.typ)
|
||||||
if col >= dc.typ.len:
|
if col >= dc.typ.len:
|
||||||
localError(c.config, info, "cannot instantiate: '" & dc.name.s & "'")
|
localError(c.config, info, "cannot instantiate: '" & dc.name.s & "'")
|
||||||
|
|
|
||||||
|
|
@ -1893,7 +1893,7 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame): TFullReg =
|
||||||
var error: string
|
var error: string
|
||||||
let ast = parseString(regs[rb].node.strVal, c.cache, c.config,
|
let ast = parseString(regs[rb].node.strVal, c.cache, c.config,
|
||||||
regs[rc].node.strVal, 0,
|
regs[rc].node.strVal, 0,
|
||||||
proc (conf: ConfigRef; info: TLineInfo; msg: TMsgKind; arg: string) {.nosinks.} =
|
proc (conf: ConfigRef; info: TLineInfo; msg: TMsgKind; arg: string) =
|
||||||
if error.len == 0 and msg <= errMax:
|
if error.len == 0 and msg <= errMax:
|
||||||
error = formatMsg(conf, info, msg, arg))
|
error = formatMsg(conf, info, msg, arg))
|
||||||
if error.len > 0:
|
if error.len > 0:
|
||||||
|
|
@ -1908,7 +1908,7 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame): TFullReg =
|
||||||
var error: string
|
var error: string
|
||||||
let ast = parseString(regs[rb].node.strVal, c.cache, c.config,
|
let ast = parseString(regs[rb].node.strVal, c.cache, c.config,
|
||||||
regs[rc].node.strVal, 0,
|
regs[rc].node.strVal, 0,
|
||||||
proc (conf: ConfigRef; info: TLineInfo; msg: TMsgKind; arg: string) {.nosinks.} =
|
proc (conf: ConfigRef; info: TLineInfo; msg: TMsgKind; arg: string) =
|
||||||
if error.len == 0 and msg <= errMax:
|
if error.len == 0 and msg <= errMax:
|
||||||
error = formatMsg(conf, info, msg, arg))
|
error = formatMsg(conf, info, msg, arg))
|
||||||
if error.len > 0:
|
if error.len > 0:
|
||||||
|
|
@ -2309,7 +2309,7 @@ proc setupGlobalCtx*(module: PSym; graph: ModuleGraph; idgen: IdGenerator) =
|
||||||
else:
|
else:
|
||||||
refresh(PCtx graph.vm, module, idgen)
|
refresh(PCtx graph.vm, module, idgen)
|
||||||
|
|
||||||
proc setupEvalGen*(graph: ModuleGraph; module: PSym; idgen: IdGenerator): PPassContext {.nosinks.} =
|
proc setupEvalGen*(graph: ModuleGraph; module: PSym; idgen: IdGenerator): PPassContext =
|
||||||
#var c = newEvalContext(module, emRepl)
|
#var c = newEvalContext(module, emRepl)
|
||||||
#c.features = {allowCast, allowInfiniteLoops}
|
#c.features = {allowCast, allowInfiniteLoops}
|
||||||
#pushStackFrame(c, newStackFrame())
|
#pushStackFrame(c, newStackFrame())
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue