Commit 42c2e85
CLJS-2136: Clarify IFind contract to avoid double-lookups
* Adds a docstring to the -find method clarifying that implementors
may need to return nil.
* Changes find to test for and use IFind first rather than testing for
key containment first.
* Changes all IFind implementations in core to perform key checks and
value retrieval in a single lookup.
* Adds some more tests for find on a vector using degenerate keys.
* Alters a test using find because of contact ambiguity to use -find
instead.1 parent 1f95b5e commit 42c2e85
File tree
3 files changed
+37
-32
lines changed- src
- main/cljs/cljs
- test/cljs/cljs
3 files changed
+37
-32
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
548 | 548 | | |
549 | 549 | | |
550 | 550 | | |
551 | | - | |
| 551 | + | |
552 | 552 | | |
553 | 553 | | |
554 | 554 | | |
| |||
2242 | 2242 | | |
2243 | 2243 | | |
2244 | 2244 | | |
2245 | | - | |
2246 | | - | |
2247 | | - | |
2248 | | - | |
2249 | | - | |
| 2245 | + | |
| 2246 | + | |
| 2247 | + | |
| 2248 | + | |
| 2249 | + | |
2250 | 2250 | | |
2251 | 2251 | | |
2252 | 2252 | | |
| |||
5231 | 5231 | | |
5232 | 5232 | | |
5233 | 5233 | | |
5234 | | - | |
5235 | | - | |
| 5234 | + | |
| 5235 | + | |
| 5236 | + | |
5236 | 5237 | | |
5237 | 5238 | | |
5238 | 5239 | | |
| |||
5522 | 5523 | | |
5523 | 5524 | | |
5524 | 5525 | | |
5525 | | - | |
5526 | | - | |
| 5526 | + | |
| 5527 | + | |
| 5528 | + | |
5527 | 5529 | | |
5528 | 5530 | | |
5529 | 5531 | | |
| |||
6060 | 6062 | | |
6061 | 6063 | | |
6062 | 6064 | | |
6063 | | - | |
| 6065 | + | |
| 6066 | + | |
| 6067 | + | |
6064 | 6068 | | |
6065 | 6069 | | |
6066 | 6070 | | |
| |||
6289 | 6293 | | |
6290 | 6294 | | |
6291 | 6295 | | |
6292 | | - | |
6293 | | - | |
6294 | | - | |
6295 | | - | |
| 6296 | + | |
| 6297 | + | |
| 6298 | + | |
| 6299 | + | |
6296 | 6300 | | |
6297 | 6301 | | |
6298 | 6302 | | |
| |||
6505 | 6509 | | |
6506 | 6510 | | |
6507 | 6511 | | |
6508 | | - | |
| 6512 | + | |
| 6513 | + | |
6509 | 6514 | | |
6510 | 6515 | | |
6511 | 6516 | | |
| |||
7949 | 7954 | | |
7950 | 7955 | | |
7951 | 7956 | | |
7952 | | - | |
7953 | | - | |
7954 | | - | |
7955 | | - | |
| 7957 | + | |
| 7958 | + | |
| 7959 | + | |
| 7960 | + | |
7956 | 7961 | | |
7957 | 7962 | | |
7958 | 7963 | | |
| |||
8110 | 8115 | | |
8111 | 8116 | | |
8112 | 8117 | | |
8113 | | - | |
8114 | | - | |
8115 | | - | |
8116 | | - | |
| 8118 | + | |
| 8119 | + | |
| 8120 | + | |
| 8121 | + | |
8117 | 8122 | | |
8118 | 8123 | | |
8119 | 8124 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
40 | 45 | | |
41 | 46 | | |
42 | 47 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
| 116 | + | |
| 117 | + | |
123 | 118 | | |
124 | 119 | | |
125 | 120 | | |
| |||
0 commit comments