-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
delete a lot of dead code #11981
delete a lot of dead code #11981
Conversation
16d6720
to
b37e593
Compare
b37e593
to
9aef8a1
Compare
else: | ||
genAssignment(p, d, tmpB, {}) | ||
else: | ||
when true: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: you could do the same as in https://github.com/nim-lang/Nim/pull/11981/files#diff-c771980a90bdbd4401f414dee2b14915R32 — without when true
, just unindent its block. I think it is a cleaner solution.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yea I can. I decided against it because in such a big PR I wanted to focus on trivial code changes. In the code you reference I wasn't so strict yet.
Awesome work. 🙂 👍 |
@@ -1455,14 +1455,6 @@ proc parseExprStmt(p: var TParser): PNode = | |||
|
|||
proc parseModuleName(p: var TParser, kind: TNodeKind): PNode = | |||
result = parseExpr(p) | |||
when false: | |||
# parseExpr already handles 'as' syntax ... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe keep the comment # parseExpr already handles 'as' syntax ...
@@ -150,15 +149,6 @@ proc commonType*(x, y: PType): PType = | |||
# run people expect ranges to work properly within a tuple. | |||
if not sameType(a, b): | |||
result = skipTypes(a, {tyRange}).skipIntLit | |||
when false: | |||
if a.kind != tyRange and b.kind == tyRange: | |||
# XXX This really needs a better solution, but a proper fix now breaks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe at least summarize this deleted block with a comment
@@ -365,18 +365,6 @@ proc semObjConstr(c: PContext, n: PNode, flags: TExprFlags): PNode = | |||
# branches will be reported as an error): | |||
let initResult = semConstructType(c, result, t, flags) | |||
|
|||
# It's possible that the object was not fully initialized while |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this definitely should show at least a summarizing comment; might as well keep this block IMO as it's still in TODO state
@@ -480,21 +480,12 @@ proc semVarOrLet(c: PContext, n: PNode, symkind: TSymKind): PNode = | |||
($typ.kind).substr(2).toLowerAscii) | |||
elif typ.kind == tyProc and tfUnresolved in typ.flags: | |||
localError(c.config, def.info, errProcHasNoConcreteType % def.renderTree) | |||
when false: | |||
# XXX This typing rule is neither documented nor complete enough to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
at least some comment should stay
@@ -133,14 +133,6 @@ proc initCandidate*(ctx: PContext, c: var TCandidate, callee: PType) = | |||
initIdTable(c.bindings) | |||
|
|||
proc put(c: var TCandidate, key, val: PType) {.inline.} = | |||
when false: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
useful to keep for debugging (I've actually used it) ; maybe add a comment instead of deleting:
when false: # debugging
...
@@ -2506,9 +2451,6 @@ proc matches*(c: PContext, n, nOrig: PNode, m: var TCandidate) = | |||
m.call = n | |||
# Note the following doesn't work as it would produce ambiguities. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this comment now makes no sense after the code is deleted; maybe enhance the comment instead
@@ -935,11 +911,6 @@ proc transform(c: PTransf, n: PNode): PTransNode = | |||
result = PTransNode(n) | |||
of nkMacroDef: | |||
# XXX no proper closure support yet: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this comment now makes no sense; maybe keep dead code (as a WIP)
@@ -477,10 +459,6 @@ proc runCI(cmd: string) = | |||
## build nimble early on to enable remainder to depend on it if needed | |||
kochExecFold("Build Nimble", "nimble") | |||
|
|||
when false: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please keep this and maybe add a comment # consider re-enabling
or similar; original PR #10150 showed when not defined(windows):
and then was turned into when false
in c5dbb03 ; as a result compile time FFI is not being tested in testament anymore and (unsurprisingly) it started to bitrot, cf my PR from yesterday #11991
CTFFI is a super powerful feature that I heavily rely on; it needs more eyes on it, not less
@@ -87,11 +87,3 @@ proc newImpl(t: ptr TypeLayout): pointer = | |||
|
|||
template new*[T](x: var ref T) = | |||
x = newImpl(getTypeLayout(x)) | |||
|
|||
|
|||
when false: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd keep this block, this is a reference
@@ -294,8 +294,6 @@ iterator fields*(x: Any): tuple[name: string, any: Any] = | |||
var p = x.value | |||
var t = x.rawType | |||
# XXX BUG: does not work yet, however is questionable anyway |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment makes no sense after deletion; either keep that block (might as well) or enhance comment; likewise with other instances in this file
@@ -812,58 +812,6 @@ proc acceptAddr*(server: Socket, client: var owned(Socket), address: var string, | |||
let ret = SSLAccept(client.sslHandle) | |||
socketError(client, ret, false) | |||
|
|||
when false: #defineSsl: | |||
proc acceptAddrSSL*(server: Socket, client: var Socket, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -410,15 +410,6 @@ proc pageAddr(p: pointer): PChunk {.inline.} = | |||
result = cast[PChunk](cast[ByteAddress](p) and not PageMask) | |||
#sysAssert(Contains(allocator.chunkStarts, pageIndex(result))) | |||
|
|||
when false: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe keep with a comment when false: # debugging
?
@@ -1009,14 +901,6 @@ template instantiateForRegion(allocator: untyped) = | |||
proc realloc(p: pointer, newsize: Natural): pointer = | |||
result = realloc(allocator, p, newsize) | |||
|
|||
when false: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd keep this (used in commented out #sysAssert(result == countFreeMem())
)
or if you do remove it, you'd need to also remove #sysAssert(result == countFreeMem())
@@ -142,11 +142,6 @@ proc genericDeepCopyAux(dest, src: pointer, mt: PNimType; tab: var PtrTable) = | |||
tab.put(s2, z) | |||
genericDeepCopyAux(z, s2, realType.base, tab) | |||
else: | |||
when false: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd keep this; I think I've used this during a debugging session
@@ -451,13 +446,6 @@ proc GC_dumpHeap*(file: File) = | |||
## can be translated into "dot" syntax via the "heapdump2dot" tool. | |||
gch.pDumpHeapFile = file | |||
var spaceIter: ObjectSpaceIter | |||
when false: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems useful (and non-trivial) for debugging
@@ -23,8 +23,6 @@ Base.pr | |||
Child.pr | |||
|
|||
Base.me | |||
when false: | |||
Child.me #<- bug #2710 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
disabled code for documentation purposes => I'd keep it
@@ -63,17 +63,6 @@ proc asyncTest() {.async.} = | |||
except: | |||
doAssert(false, "HttpRequestError should have been raised") | |||
|
|||
|
|||
when false: | |||
# w3.org now blocks travis, so disabled: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems useful code that can be run locally to test functionality
@@ -71,9 +71,6 @@ block: | |||
block: | |||
static: | |||
# for joint test, the project path is different, so I disabled it: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment makes no sense after deletion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 for this; I went through everything; a small fraction should stay or require some minor changes, see comments
I won't merge this, in plenty of places the |
This PR is ruthless, when some code is deactivated with
when false
, I deleted it. One reason this PR is here is to show how much dead code has been accumulated over the years. I think at some point one should just dump it all.