diff --git a/src/wasm-lib/kcl/src/ast/types/condition.rs b/src/wasm-lib/kcl/src/ast/types/condition.rs index 9244a41305..5f74ad448f 100644 --- a/src/wasm-lib/kcl/src/ast/types/condition.rs +++ b/src/wasm-lib/kcl/src/ast/types/condition.rs @@ -25,6 +25,8 @@ pub struct IfExpression { pub else_ifs: NodeList, pub final_else: BoxNode, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] pub digest: Option, } @@ -36,6 +38,8 @@ pub struct ElseIf { pub cond: Expr, pub then_val: BoxNode, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] pub digest: Option, } diff --git a/src/wasm-lib/kcl/src/parser/snapshots/kcl_lib__parser__parser_impl__snapshot_tests__bc.snap b/src/wasm-lib/kcl/src/parser/snapshots/kcl_lib__parser__parser_impl__snapshot_tests__bc.snap index f666a67f38..5243454999 100644 --- a/src/wasm-lib/kcl/src/parser/snapshots/kcl_lib__parser__parser_impl__snapshot_tests__bc.snap +++ b/src/wasm-lib/kcl/src/parser/snapshots/kcl_lib__parser__parser_impl__snapshot_tests__bc.snap @@ -1,6 +1,7 @@ --- source: kcl/src/parser/parser_impl.rs expression: actual +snapshot_kind: text --- { "body": [ @@ -23,7 +24,6 @@ expression: actual "type": "Literal", "value": true }, - "digest": null, "else_ifs": [], "end": 74, "final_else": { diff --git a/src/wasm-lib/kcl/src/parser/snapshots/kcl_lib__parser__parser_impl__snapshot_tests__bd.snap b/src/wasm-lib/kcl/src/parser/snapshots/kcl_lib__parser__parser_impl__snapshot_tests__bd.snap index e27be60c5a..85eccecbd5 100644 --- a/src/wasm-lib/kcl/src/parser/snapshots/kcl_lib__parser__parser_impl__snapshot_tests__bd.snap +++ b/src/wasm-lib/kcl/src/parser/snapshots/kcl_lib__parser__parser_impl__snapshot_tests__bd.snap @@ -1,6 +1,7 @@ --- source: kcl/src/parser/parser_impl.rs expression: actual +snapshot_kind: text --- { "body": [ @@ -23,7 +24,6 @@ expression: actual "type": "Literal", "value": true }, - "digest": null, "else_ifs": [ { "cond": { @@ -48,7 +48,6 @@ expression: actual "type": "CallExpression", "type": "CallExpression" }, - "digest": null, "end": 90, "start": 44, "then_val": { diff --git a/src/wasm-lib/kcl/tests/if_else/ast.snap b/src/wasm-lib/kcl/tests/if_else/ast.snap index 507f5a315b..fd1d2c3701 100644 --- a/src/wasm-lib/kcl/tests/if_else/ast.snap +++ b/src/wasm-lib/kcl/tests/if_else/ast.snap @@ -25,7 +25,6 @@ snapshot_kind: text "type": "Literal", "value": true }, - "digest": null, "else_ifs": [ { "cond": { @@ -36,7 +35,6 @@ snapshot_kind: text "type": "Literal", "value": true }, - "digest": null, "end": 88, "start": 68, "then_val": { @@ -188,7 +186,6 @@ snapshot_kind: text "type": "Literal", "value": false }, - "digest": null, "else_ifs": [ { "cond": { @@ -199,7 +196,6 @@ snapshot_kind: text "type": "Literal", "value": true }, - "digest": null, "end": 202, "start": 182, "then_val": { @@ -351,7 +347,6 @@ snapshot_kind: text "type": "Literal", "value": false }, - "digest": null, "else_ifs": [ { "cond": { @@ -362,7 +357,6 @@ snapshot_kind: text "type": "Literal", "value": false }, - "digest": null, "end": 322, "start": 301, "then_val": {