Repository navigation
chore: remove code that never runs or never changes a result - #13739
Closed
yuxi-liu-wired wants to merge 10 commits into
Closed
yuxi-liu-wired wants to merge 10 commits into
yuxi-liu-wired wants to merge 10 commits into
Conversation
Every JS array has Symbol.iterator, so the iterator clause above it always takes an array first; the clause never runs.
Its test is the same as the clause above, so it is never chosen.
get-all-properties removes recycled properties (those with deleted-at) first, so copying deleted-at onto the result never happens. render-bottom-position-property?: a :node property already passes (not= :default type), so node-many? adds nothing to the or.
…exists! *uuids maps a uuid U to the uuid of the entity found by [:block/uuid U], which is U, so the remap rewrites each lookup ref to itself.
The private fn's only caller passes both arguments.
…s->vec-tree Both callers (editor handler, plugin API block tree) pass a block uuid or nil.
With class? the existing page is looked up among pages tagged Tag
(page-exists? with #{:logseq.class/Tag}), or is a journal page, so it is
never a non-class internal page and the branch never runs.
…e-tx-data block is an entity in every caller, and an entity's cardinality-many value is a set, never sequential, so the check is always false.
ops' falls back to [[:transact ...]] when there are no semantic ops, so (seq ops') is always true.
The atom is read only inside a (comment ...) form, so registering the worker's debounced store has no effect.
yuxi-liu-wired
force-pushed
the
fix/remove-unreachable-code
branch
from
October 16, 2026 18:36
37aa4cd to
a5e4d4c
Compare
Contributor
Author
|
Combined with the other PRs that change the same files into #13786. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Removes code that never runs or never changes a result. Each removal is its own commit, with the reason in its message; behaviour is unchanged.
get-sql-rows(db-sync and publish copies): the(array? result)clause. Every JS array hasSymbol.iterator, so the iterator clause before it always takes an array first.search-fuzzy/score: acondclause whose test repeats the clause before it.get-all-properties: copying:logseq.property/deleted-atonto each result. Recycled properties (those withdeleted-at) are removed first.render-bottom-position-property?:node-many?. A:nodeproperty already passes(not= :default type)in the sameor.ensure-built-in-data-exists!: the*uuidsremap. It maps a uuid U to the uuid of the entity found by[:block/uuid U], which is U, so every lookup ref is rewritten to itself.delete-blocks/build-retracted-tx: the unused 1-arity of this private fn.outliner.tree/blocks->vec-tree: the number and string root-id branches. Both callers pass a block uuid or nil.page/create: the convert-to-class branch. Withclass?the existing page is looked up among pages tagged Tag (or is a journal), so it is never a non-class internal page.build-property-value-tx-data:multiple-values-empty?. The block is an entity in every caller, and an entity's cardinality-many value is a set, never sequential.apply-history-action!: the:unsupported-history-actionbranch after(seq ops').ops'falls back to[[:transact ...]], so it is never empty.logseq.db:*debounce-fnandregister-debounce-fn!. The atom is read only inside a(comment ...)form.Found by mutation testing (each was a surviving mutant: removing or changing it changed nothing any test could see), then checked against every caller on master.