Validate that dict keys are unique during parse
This commit is contained in:
parent
270e13b27b
commit
d0af002b4a
|
@ -54,8 +54,12 @@ proc parsePreserves*(text: string): Preserve[void] {.gcsafe.} =
|
|||
var prs = Value(kind: pkDictionary)
|
||||
for i in countDown(stack.high.pred, 0, 2):
|
||||
if stack[i].pos < capture[0].si: break
|
||||
prs[move stack[i].value] = stack[i.succ].value
|
||||
stack.shrink prs.dict.len*2
|
||||
var
|
||||
val = stack.pop.value
|
||||
key = stack.pop.value
|
||||
for j in 0..prs.dict.high:
|
||||
validate(prs.dict[j].key != key)
|
||||
prs[key] = val
|
||||
pushStack prs
|
||||
|
||||
Preserves.Set <- Preserves.Set:
|
||||
|
|
Loading…
Reference in New Issue