Compare commits

...

3 Commits

Author SHA1 Message Date
47c78fe8a3 A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest-8-cores) 2024-11-05 17:03:19 +00:00
24faa9fb8c Don't serialize "startNodes" if it's empty
This makes our snapshots and JSON less verbose.
2024-11-05 10:42:33 -06:00
d2ec1e5bd5 Don't serialize empty 'digest' on IfExprs 2024-11-05 10:42:30 -06:00
20 changed files with 38 additions and 57 deletions

View File

@ -93200,8 +93200,7 @@
"NonCodeMeta": { "NonCodeMeta": {
"type": "object", "type": "object",
"required": [ "required": [
"nonCodeNodes", "nonCodeNodes"
"startNodes"
], ],
"properties": { "properties": {
"nonCodeNodes": { "nonCodeNodes": {
@ -96944,8 +96943,7 @@
"NonCodeMeta": { "NonCodeMeta": {
"type": "object", "type": "object",
"required": [ "required": [
"nonCodeNodes", "nonCodeNodes"
"startNodes"
], ],
"properties": { "properties": {
"nonCodeNodes": { "nonCodeNodes": {
@ -100692,8 +100690,7 @@
"NonCodeMeta": { "NonCodeMeta": {
"type": "object", "type": "object",
"required": [ "required": [
"nonCodeNodes", "nonCodeNodes"
"startNodes"
], ],
"properties": { "properties": {
"nonCodeNodes": { "nonCodeNodes": {
@ -130888,8 +130885,7 @@
"NonCodeMeta": { "NonCodeMeta": {
"type": "object", "type": "object",
"required": [ "required": [
"nonCodeNodes", "nonCodeNodes"
"startNodes"
], ],
"properties": { "properties": {
"nonCodeNodes": { "nonCodeNodes": {
@ -135023,8 +135019,7 @@
"NonCodeMeta": { "NonCodeMeta": {
"type": "object", "type": "object",
"required": [ "required": [
"nonCodeNodes", "nonCodeNodes"
"startNodes"
], ],
"properties": { "properties": {
"nonCodeNodes": { "nonCodeNodes": {
@ -138765,8 +138760,7 @@
"NonCodeMeta": { "NonCodeMeta": {
"type": "object", "type": "object",
"required": [ "required": [
"nonCodeNodes", "nonCodeNodes"
"startNodes"
], ],
"properties": { "properties": {
"nonCodeNodes": { "nonCodeNodes": {
@ -142918,8 +142912,7 @@
"NonCodeMeta": { "NonCodeMeta": {
"type": "object", "type": "object",
"required": [ "required": [
"nonCodeNodes", "nonCodeNodes"
"startNodes"
], ],
"properties": { "properties": {
"nonCodeNodes": { "nonCodeNodes": {
@ -147053,8 +147046,7 @@
"NonCodeMeta": { "NonCodeMeta": {
"type": "object", "type": "object",
"required": [ "required": [
"nonCodeNodes", "nonCodeNodes"
"startNodes"
], ],
"properties": { "properties": {
"nonCodeNodes": { "nonCodeNodes": {
@ -150797,8 +150789,7 @@
"NonCodeMeta": { "NonCodeMeta": {
"type": "object", "type": "object",
"required": [ "required": [
"nonCodeNodes", "nonCodeNodes"
"startNodes"
], ],
"properties": { "properties": {
"nonCodeNodes": { "nonCodeNodes": {
@ -154539,8 +154530,7 @@
"NonCodeMeta": { "NonCodeMeta": {
"type": "object", "type": "object",
"required": [ "required": [
"nonCodeNodes", "nonCodeNodes"
"startNodes"
], ],
"properties": { "properties": {
"nonCodeNodes": { "nonCodeNodes": {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 43 KiB

View File

@ -1029,6 +1029,7 @@ pub enum NonCodeValue {
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct NonCodeMeta { pub struct NonCodeMeta {
pub non_code_nodes: HashMap<usize, NodeList<NonCodeNode>>, pub non_code_nodes: HashMap<usize, NodeList<NonCodeNode>>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub start_nodes: NodeList<NonCodeNode>, pub start_nodes: NodeList<NonCodeNode>,
#[serde(default, skip_serializing_if = "Option::is_none")] #[serde(default, skip_serializing_if = "Option::is_none")]
@ -1059,6 +1060,7 @@ impl<'de> Deserialize<'de> for NonCodeMeta {
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
struct NonCodeMetaHelper { struct NonCodeMetaHelper {
non_code_nodes: HashMap<String, NodeList<NonCodeNode>>, non_code_nodes: HashMap<String, NodeList<NonCodeNode>>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
start_nodes: NodeList<NonCodeNode>, start_nodes: NodeList<NonCodeNode>,
} }

View File

@ -25,6 +25,8 @@ pub struct IfExpression {
pub else_ifs: NodeList<ElseIf>, pub else_ifs: NodeList<ElseIf>,
pub final_else: BoxNode<IfBlock>, pub final_else: BoxNode<IfBlock>,
#[serde(default, skip_serializing_if = "Option::is_none")]
#[ts(optional)]
pub digest: Option<Digest>, pub digest: Option<Digest>,
} }
@ -36,6 +38,8 @@ pub struct ElseIf {
pub cond: Expr, pub cond: Expr,
pub then_val: BoxNode<IfBlock>, pub then_val: BoxNode<IfBlock>,
#[serde(default, skip_serializing_if = "Option::is_none")]
#[ts(optional)]
pub digest: Option<Digest>, pub digest: Option<Digest>,
} }

View File

@ -1,6 +1,7 @@
--- ---
source: kcl/src/parser/parser_impl.rs source: kcl/src/parser/parser_impl.rs
expression: actual expression: actual
snapshot_kind: text
--- ---
{ {
"body": [ "body": [
@ -60,8 +61,7 @@ expression: actual
} }
} }
] ]
}, }
"startNodes": []
}, },
"start": 14, "start": 14,
"type": "ArrayExpression", "type": "ArrayExpression",

View File

@ -1,6 +1,7 @@
--- ---
source: kcl/src/parser/parser_impl.rs source: kcl/src/parser/parser_impl.rs
expression: actual expression: actual
snapshot_kind: text
--- ---
{ {
"body": [ "body": [
@ -60,8 +61,7 @@ expression: actual
} }
} }
] ]
}, }
"startNodes": []
}, },
"start": 14, "start": 14,
"type": "ArrayExpression", "type": "ArrayExpression",

View File

@ -1,6 +1,7 @@
--- ---
source: kcl/src/parser/parser_impl.rs source: kcl/src/parser/parser_impl.rs
expression: actual expression: actual
snapshot_kind: text
--- ---
{ {
"body": [ "body": [
@ -30,8 +31,7 @@ expression: actual
} }
} }
] ]
}, }
"startNodes": []
}, },
"properties": [ "properties": [
{ {

View File

@ -1,6 +1,7 @@
--- ---
source: kcl/src/parser/parser_impl.rs source: kcl/src/parser/parser_impl.rs
expression: actual expression: actual
snapshot_kind: text
--- ---
{ {
"body": [ "body": [
@ -30,8 +31,7 @@ expression: actual
} }
} }
] ]
}, }
"startNodes": []
}, },
"properties": [ "properties": [
{ {

View File

@ -1,6 +1,7 @@
--- ---
source: kcl/src/parser/parser_impl.rs source: kcl/src/parser/parser_impl.rs
expression: actual expression: actual
snapshot_kind: text
--- ---
{ {
"body": [ "body": [
@ -106,8 +107,7 @@ expression: actual
} }
} }
] ]
}, }
"startNodes": []
}, },
"start": 19, "start": 19,
"type": "PipeExpression", "type": "PipeExpression",

View File

@ -1,6 +1,7 @@
--- ---
source: kcl/src/parser/parser_impl.rs source: kcl/src/parser/parser_impl.rs
expression: actual expression: actual
snapshot_kind: text
--- ---
{ {
"body": [ "body": [
@ -23,7 +24,6 @@ expression: actual
"type": "Literal", "type": "Literal",
"value": true "value": true
}, },
"digest": null,
"else_ifs": [], "else_ifs": [],
"end": 74, "end": 74,
"final_else": { "final_else": {

View File

@ -1,6 +1,7 @@
--- ---
source: kcl/src/parser/parser_impl.rs source: kcl/src/parser/parser_impl.rs
expression: actual expression: actual
snapshot_kind: text
--- ---
{ {
"body": [ "body": [
@ -23,7 +24,6 @@ expression: actual
"type": "Literal", "type": "Literal",
"value": true "value": true
}, },
"digest": null,
"else_ifs": [ "else_ifs": [
{ {
"cond": { "cond": {
@ -48,7 +48,6 @@ expression: actual
"type": "CallExpression", "type": "CallExpression",
"type": "CallExpression" "type": "CallExpression"
}, },
"digest": null,
"end": 90, "end": 90,
"start": 44, "start": 44,
"then_val": { "then_val": {

View File

@ -1,6 +1,7 @@
--- ---
source: kcl/src/parser/parser_impl.rs source: kcl/src/parser/parser_impl.rs
expression: actual expression: actual
snapshot_kind: text
--- ---
{ {
"body": [ "body": [
@ -48,8 +49,7 @@ expression: actual
} }
} }
] ]
}, }
"startNodes": []
}, },
"start": 0 "start": 0
} }

View File

@ -3197,8 +3197,7 @@ snapshot_kind: text
} }
} }
] ]
}, }
"startNodes": []
}, },
"start": 0 "start": 0
} }

View File

@ -848,8 +848,7 @@ snapshot_kind: text
} }
} }
] ]
}, }
"startNodes": []
}, },
"start": 0 "start": 0
} }

View File

@ -651,8 +651,7 @@ snapshot_kind: text
} }
} }
] ]
}, }
"startNodes": []
}, },
"start": 0 "start": 0
} }

View File

@ -664,8 +664,7 @@ snapshot_kind: text
} }
} }
] ]
}, }
"startNodes": []
}, },
"start": 30 "start": 30
}, },
@ -787,8 +786,7 @@ snapshot_kind: text
} }
} }
] ]
}, }
"startNodes": []
}, },
"start": 0 "start": 0
} }

View File

@ -681,8 +681,7 @@ snapshot_kind: text
} }
} }
] ]
}, }
"startNodes": []
}, },
"start": 30 "start": 30
}, },

View File

@ -226,8 +226,7 @@ snapshot_kind: text
} }
} }
] ]
}, }
"startNodes": []
}, },
"start": 0 "start": 0
} }

View File

@ -25,7 +25,6 @@ snapshot_kind: text
"type": "Literal", "type": "Literal",
"value": true "value": true
}, },
"digest": null,
"else_ifs": [ "else_ifs": [
{ {
"cond": { "cond": {
@ -36,7 +35,6 @@ snapshot_kind: text
"type": "Literal", "type": "Literal",
"value": true "value": true
}, },
"digest": null,
"end": 88, "end": 88,
"start": 68, "start": 68,
"then_val": { "then_val": {
@ -188,7 +186,6 @@ snapshot_kind: text
"type": "Literal", "type": "Literal",
"value": false "value": false
}, },
"digest": null,
"else_ifs": [ "else_ifs": [
{ {
"cond": { "cond": {
@ -199,7 +196,6 @@ snapshot_kind: text
"type": "Literal", "type": "Literal",
"value": true "value": true
}, },
"digest": null,
"end": 202, "end": 202,
"start": 182, "start": 182,
"then_val": { "then_val": {
@ -351,7 +347,6 @@ snapshot_kind: text
"type": "Literal", "type": "Literal",
"value": false "value": false
}, },
"digest": null,
"else_ifs": [ "else_ifs": [
{ {
"cond": { "cond": {
@ -362,7 +357,6 @@ snapshot_kind: text
"type": "Literal", "type": "Literal",
"value": false "value": false
}, },
"digest": null,
"end": 322, "end": 322,
"start": 301, "start": 301,
"then_val": { "then_val": {

View File

@ -837,8 +837,7 @@ snapshot_kind: text
} }
} }
] ]
}, }
"startNodes": []
}, },
"start": 0 "start": 0
} }