`Emissions.emitArg` branches into two identical arms in `Emissions.java`
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 88/100
Research direction
Start at emitArg in eo-parser/src/main/java/org/eolang/parser/Emissions.java:173 and compare ChainEmission.link at ChainEmission.java:108. Remove the duplicate branch by using the shared path, preserving the @as slot, @const marker, and close handling for both chained and unchained arguments.
Written by the indexing model from the issue text.
Description
Emissions.emitArg at eo-parser/src/main/java/org/eolang/parser/Emissions.java:173 branches on whether the argument carries a .method chain and then writes the same eight lines in both arms. The chained arm calls ChainEmission.link(emit, line, value, tail, null); the unchained one calls Emissions.openValue(emit, null, value, line), which is precisely what link does for an empty chain at ChainEmission.java:108 — with label being the same null the caller hands it, and the loop that follows running zero times. The @as slot, the @const marker and the close after them are identical on both sides.
The condition is left over from bfad5b019c, the fix for #6982, which pointed the chained arm at ChainEmission.link and left the other one on the direct call it used before. What remains is a guard against the code it is guarding, and two copies of the argument's binding and const handling that can only ever drift apart by hand.
Calling ChainEmission.link unconditionally and deleting the branch removes about ten lines and leaves one path through emitArg for a chained and an unchained argument alike.
@yegor256 please take a look
- Dominant language
- Java
- Stars
- 1.5k
- Forks
- 251
- Avg merge
- 22h 52m
- Merged PRs (30d)
- 653
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from objectionary/eo
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
objectionary/eo#8869 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
objectionary/eo#8853 ·
-
bug good-title
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
objectionary/eo#8852 ·
-
bug good-title
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
objectionary/eo#8851 ·
-
bug good-title
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
objectionary/eo#8850 ·
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
infinispan/infinispan#18150 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
opensearch-project/k-NN#3597 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100