mirror of
https://github.com/nim-lang/Nim.git
synced 2026-06-05 03:14:08 +00:00
fix json bug []= misplaced (#10397)
This commit is contained in:
committed by
Arne Döring
parent
28b3c8d74d
commit
32a90f7406
@@ -357,6 +357,11 @@ when false:
|
||||
assert false notin elements, "usage error: only empty sets allowed"
|
||||
assert true notin elements, "usage error: only empty sets allowed"
|
||||
|
||||
proc `[]=`*(obj: JsonNode, key: string, val: JsonNode) {.inline.} =
|
||||
## Sets a field from a `JObject`.
|
||||
assert(obj.kind == JObject)
|
||||
obj.fields[key] = val
|
||||
|
||||
#[
|
||||
Note: could use simply:
|
||||
proc `%`*(o: object|tuple): JsonNode
|
||||
@@ -522,11 +527,6 @@ proc contains*(node: JsonNode, val: JsonNode): bool =
|
||||
proc existsKey*(node: JsonNode, key: string): bool {.deprecated: "use hasKey instead".} = node.hasKey(key)
|
||||
## **Deprecated:** use `hasKey` instead.
|
||||
|
||||
proc `[]=`*(obj: JsonNode, key: string, val: JsonNode) {.inline.} =
|
||||
## Sets a field from a `JObject`.
|
||||
assert(obj.kind == JObject)
|
||||
obj.fields[key] = val
|
||||
|
||||
proc `{}`*(node: JsonNode, keys: varargs[string]): JsonNode =
|
||||
## Traverses the node and gets the given value. If any of the
|
||||
## keys do not exist, returns ``nil``. Also returns ``nil`` if one of the
|
||||
|
||||
Reference in New Issue
Block a user