diff options
author | ringabout <43030857+ringabout@users.noreply.github.com> | 2023-08-06 20:26:21 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-06 14:26:21 +0200 |
commit | 93ced31353813c2f19c38a8c0af44737fa8d9f86 (patch) | |
tree | 715daec93fe236affb698f0b1963aafdef6b71af /compiler/cgmeth.nim | |
parent | 53586d1f32dfe4f2e859178a3e43a6614520763f (diff) | |
download | Nim-93ced31353813c2f19c38a8c0af44737fa8d9f86.tar.gz |
use strictdefs for compiler (#22365)
* wip; use strictdefs for compiler * checkpoint * complete the chores * more fixes * first phase cleanup * Update compiler/bitsets.nim * cleanup
Diffstat (limited to 'compiler/cgmeth.nim')
-rw-r--r-- | compiler/cgmeth.nim | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/compiler/cgmeth.nim b/compiler/cgmeth.nim index cc37691fd..ed8f33630 100644 --- a/compiler/cgmeth.nim +++ b/compiler/cgmeth.nim @@ -44,6 +44,8 @@ proc getDispatcher*(s: PSym): PSym = if dispatcherPos < s.ast.len: result = s.ast[dispatcherPos].sym doAssert sfDispatcher in result.flags + else: + result = nil proc methodCall*(n: PNode; conf: ConfigRef): PNode = result = n @@ -62,6 +64,7 @@ type MethodResult = enum No, Invalid, Yes proc sameMethodBucket(a, b: PSym; multiMethods: bool): MethodResult = + result = No if a.name.id != b.name.id: return if a.typ.len != b.typ.len: return @@ -149,7 +152,7 @@ proc fixupDispatcher(meth, disp: PSym; conf: ConfigRef) = disp.ast[resultPos] = copyTree(meth.ast[resultPos]) proc methodDef*(g: ModuleGraph; idgen: IdGenerator; s: PSym) = - var witness: PSym + var witness: PSym = nil for i in 0..<g.methods.len: let disp = g.methods[i].dispatcher case sameMethodBucket(disp, s, multimethods = optMultiMethods in g.config.globalOptions) @@ -178,6 +181,7 @@ proc methodDef*(g: ModuleGraph; idgen: IdGenerator; s: PSym) = proc relevantCol(methods: seq[PSym], col: int): bool = # returns true iff the position is relevant + result = false var t = methods[0].typ[col].skipTypes(skipPtrs) if t.kind == tyObject: for i in 1..high(methods): @@ -186,6 +190,7 @@ proc relevantCol(methods: seq[PSym], col: int): bool = return true proc cmpSignatures(a, b: PSym, relevantCols: IntSet): int = + result = 0 for col in 1..<a.typ.len: if contains(relevantCols, col): var aa = skipTypes(a.typ[col], skipPtrs) |