Commit 4a1329f
authored
fix(native): add first-write-wins dedup to Rust type-map entry helpers
* fix(native): add first-write-wins dedup to Rust type-map entry helpers
`push_type_map_entry` in helpers.rs always appended to the Vec without
checking for duplicate keys, diverging from the TS `setTypeMapEntry`
which only writes when the new confidence is strictly higher than any
existing entry for the same key.
Introduce `set_type_map_entry` (mirrors TS `setTypeMapEntry`) that
scans for an existing entry and skips/replaces based on confidence.
Rewrite `push_type_map_entry` to delegate to it so all existing call
sites get the fix automatically.
In the `field_definition` handler's `None` branch (class expressions),
replace the bare `push_type_map_entry` calls with `set_type_map_entry`
at the explicit confidence values that match the TS path. Also replace
the `Some(class_name)` branch's direct `symbols.type_map.push` calls
with `set_type_map_entry` so the fallback bare keys at 0.6 confidence
are likewise deduplicated.
Fixes #1501.
Impact: 3 functions changed, 5 affected
* docs(native): correct set_type_map_entry semantics label to highest-confidence-wins1 parent e5ea649 commit 4a1329f
2 files changed
Lines changed: 41 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
958 | 958 | | |
959 | 959 | | |
960 | 960 | | |
961 | | - | |
962 | | - | |
963 | | - | |
| 961 | + | |
| 962 | + | |
| 963 | + | |
| 964 | + | |
| 965 | + | |
| 966 | + | |
| 967 | + | |
| 968 | + | |
| 969 | + | |
| 970 | + | |
| 971 | + | |
964 | 972 | | |
965 | 973 | | |
966 | 974 | | |
| 975 | + | |
967 | 976 | | |
968 | 977 | | |
969 | 978 | | |
970 | 979 | | |
971 | 980 | | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
| 984 | + | |
| 985 | + | |
| 986 | + | |
| 987 | + | |
| 988 | + | |
972 | 989 | | |
973 | 990 | | |
974 | 991 | | |
975 | | - | |
| 992 | + | |
976 | 993 | | |
977 | 994 | | |
978 | 995 | | |
| 996 | + | |
| 997 | + | |
| 998 | + | |
| 999 | + | |
| 1000 | + | |
| 1001 | + | |
| 1002 | + | |
| 1003 | + | |
| 1004 | + | |
| 1005 | + | |
| 1006 | + | |
| 1007 | + | |
| 1008 | + | |
| 1009 | + | |
979 | 1010 | | |
980 | 1011 | | |
981 | 1012 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
224 | 224 | | |
225 | 225 | | |
226 | 226 | | |
227 | | - | |
| 227 | + | |
228 | 228 | | |
229 | 229 | | |
230 | 230 | | |
| 231 | + | |
231 | 232 | | |
232 | 233 | | |
233 | | - | |
234 | | - | |
235 | | - | |
236 | | - | |
237 | | - | |
238 | | - | |
239 | | - | |
240 | | - | |
241 | | - | |
242 | | - | |
| 234 | + | |
| 235 | + | |
243 | 236 | | |
244 | 237 | | |
245 | 238 | | |
246 | 239 | | |
247 | | - | |
248 | | - | |
| 240 | + | |
| 241 | + | |
249 | 242 | | |
250 | 243 | | |
251 | 244 | | |
| |||
0 commit comments