Kwargs: assert functions (#6406)

Closes https://github.com/KittyCAD/modeling-app/issues/6408
This commit is contained in:
Adam Chalmers
2025-04-22 12:44:52 -05:00
committed by GitHub
parent 8be36d3d16
commit f99e44e371
73 changed files with 4790 additions and 4034 deletions

View File

@ -2798,53 +2798,45 @@ description: Result of parsing add_lots.kcl
"expression": {
"arguments": [
{
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "x",
"name": "isEqualTo",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
{
"commentStart": 0,
"end": 0,
"raw": "3660",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 3660.0,
"suffix": "None"
"arg": {
"commentStart": 0,
"end": 0,
"raw": "3660",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 3660.0,
"suffix": "None"
}
}
},
{
"commentStart": 0,
"end": 0,
"raw": "0.1",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.1,
"suffix": "None"
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "error",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 0,
"end": 0,
"raw": "\"Big sum\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "Big sum"
}
},
{
"commentStart": 0,
"end": 0,
"raw": "\"Big sum\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "Big sum"
}
],
"callee": {
@ -2854,7 +2846,7 @@ description: Result of parsing add_lots.kcl
"name": {
"commentStart": 0,
"end": 0,
"name": "assertEqual",
"name": "assert",
"start": 0,
"type": "Identifier"
},
@ -2865,8 +2857,24 @@ description: Result of parsing add_lots.kcl
"commentStart": 0,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": {
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "x",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
},
"start": 0,
"type": "ExpressionStatement",

View File

@ -4,4 +4,4 @@ fn f(i) {
x = f(0) + f(1) + f(2) + f(3) + f(4) + f(5) + f(6) + f(7) + f(8) + f(9) + f(10) + f(11) + f(12) + f(13) + f(14) + f(15) + f(16) + f(17) + f(18) + f(19) + f(20) + f(21) + f(22) + f(23) + f(24) + f(25) + f(26) + f(27) + f(28) + f(29) + f(30) + f(31) + f(32) + f(33) + f(34) + f(35) + f(36) + f(37) + f(38) + f(39) + f(40) + f(41) + f(42) + f(43) + f(44) + f(45) + f(46) + f(47) + f(48) + f(49) + f(50) + f(51) + f(52) + f(53) + f(54) + f(55) + f(56) + f(57) + f(58) + f(59) + f(60)
assertEqual(x, 3660, 0.1, "Big sum")
assert(x, isEqualTo = 3660, error = "Big sum")

View File

@ -8,4 +8,4 @@ fn f(i) {
x = f(0) + f(1) + f(2) + f(3) + f(4) + f(5) + f(6) + f(7) + f(8) + f(9) + f(10) + f(11) + f(12) + f(13) + f(14) + f(15) + f(16) + f(17) + f(18) + f(19) + f(20) + f(21) + f(22) + f(23) + f(24) + f(25) + f(26) + f(27) + f(28) + f(29) + f(30) + f(31) + f(32) + f(33) + f(34) + f(35) + f(36) + f(37) + f(38) + f(39) + f(40) + f(41) + f(42) + f(43) + f(44) + f(45) + f(46) + f(47) + f(48) + f(49) + f(50) + f(51) + f(52) + f(53) + f(54) + f(55) + f(56) + f(57) + f(58) + f(59) + f(60)
assertEqual(x, 3660, 0.1, "Big sum")
assert(x, isEqualTo = 3660, error = "Big sum")

View File

@ -260,110 +260,15 @@ description: Result of parsing array_elem_pop.kcl
"expression": {
"arguments": [
{
"commentStart": 0,
"computed": false,
"end": 0,
"object": {
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "new_arr1",
"name": "isEqualTo",
"start": 0,
"type": "Identifier",
"type": "Identifier"
},
"property": {
"commentStart": 0,
"end": 0,
"raw": "0",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
},
"start": 0,
"type": "MemberExpression",
"type": "MemberExpression"
},
{
"commentStart": 0,
"end": 0,
"raw": "1",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
}
},
{
"commentStart": 0,
"end": 0,
"raw": "0.00001",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.00001,
"suffix": "None"
}
},
{
"commentStart": 0,
"end": 0,
"raw": "\"element 0 should not have changed\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "element 0 should not have changed"
}
],
"callee": {
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "assertEqual",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name"
},
"commentStart": 0,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 0,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
},
{
"commentStart": 0,
"end": 0,
"expression": {
"arguments": [
{
"commentStart": 0,
"computed": false,
"end": 0,
"object": {
"commentStart": 0,
"end": 0,
"name": "new_arr1",
"start": 0,
"type": "Identifier",
"type": "Identifier"
},
"property": {
"arg": {
"commentStart": 0,
"end": 0,
"raw": "1",
@ -374,43 +279,26 @@ description: Result of parsing array_elem_pop.kcl
"value": 1.0,
"suffix": "None"
}
}
},
{
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "error",
"start": 0,
"type": "Identifier"
},
"start": 0,
"type": "MemberExpression",
"type": "MemberExpression"
},
{
"commentStart": 0,
"end": 0,
"raw": "2",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 2.0,
"suffix": "None"
"arg": {
"commentStart": 0,
"end": 0,
"raw": "\"element 0 should not have changed\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "element 0 should not have changed"
}
},
{
"commentStart": 0,
"end": 0,
"raw": "0.00001",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.00001,
"suffix": "None"
}
},
{
"commentStart": 0,
"end": 0,
"raw": "\"element 1 should not have changed\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "element 1 should not have changed"
}
],
"callee": {
@ -420,7 +308,7 @@ description: Result of parsing array_elem_pop.kcl
"name": {
"commentStart": 0,
"end": 0,
"name": "assertEqual",
"name": "assert",
"start": 0,
"type": "Identifier"
},
@ -431,8 +319,36 @@ description: Result of parsing array_elem_pop.kcl
"commentStart": 0,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": {
"commentStart": 0,
"computed": false,
"end": 0,
"object": {
"commentStart": 0,
"end": 0,
"name": "new_arr1",
"start": 0,
"type": "Identifier",
"type": "Identifier"
},
"property": {
"commentStart": 0,
"end": 0,
"raw": "0",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
},
"start": 0,
"type": "MemberExpression",
"type": "MemberExpression"
}
},
"start": 0,
"type": "ExpressionStatement",
@ -444,34 +360,80 @@ description: Result of parsing array_elem_pop.kcl
"expression": {
"arguments": [
{
"commentStart": 0,
"computed": false,
"end": 0,
"object": {
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "new_arr2",
"name": "isEqualTo",
"start": 0,
"type": "Identifier",
"type": "Identifier"
},
"property": {
"arg": {
"commentStart": 0,
"end": 0,
"raw": "0",
"raw": "2",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"value": 2.0,
"suffix": "None"
}
},
"start": 0,
"type": "MemberExpression",
"type": "MemberExpression"
}
},
{
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "error",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 0,
"end": 0,
"raw": "\"element 1 should not have changed\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "element 1 should not have changed"
}
}
],
"callee": {
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "assert",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name"
},
"commentStart": 0,
"end": 0,
"start": 0,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": {
"commentStart": 0,
"computed": false,
"end": 0,
"object": {
"commentStart": 0,
"end": 0,
"name": "new_arr1",
"start": 0,
"type": "Identifier",
"type": "Identifier"
},
"property": {
"commentStart": 0,
"end": 0,
"raw": "1",
@ -483,26 +445,60 @@ description: Result of parsing array_elem_pop.kcl
"suffix": "None"
}
},
"start": 0,
"type": "MemberExpression",
"type": "MemberExpression"
}
},
"start": 0,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
},
{
"commentStart": 0,
"end": 0,
"expression": {
"arguments": [
{
"commentStart": 0,
"end": 0,
"raw": "0.00001",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.00001,
"suffix": "None"
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "isEqualTo",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 0,
"end": 0,
"raw": "1",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
}
}
},
{
"commentStart": 0,
"end": 0,
"raw": "\"element 0 should not have changed\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "element 0 should not have changed"
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "error",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 0,
"end": 0,
"raw": "\"element 0 should not have changed\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "element 0 should not have changed"
}
}
],
"callee": {
@ -512,7 +508,7 @@ description: Result of parsing array_elem_pop.kcl
"name": {
"commentStart": 0,
"end": 0,
"name": "assertEqual",
"name": "assert",
"start": 0,
"type": "Identifier"
},
@ -523,8 +519,36 @@ description: Result of parsing array_elem_pop.kcl
"commentStart": 0,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": {
"commentStart": 0,
"computed": false,
"end": 0,
"object": {
"commentStart": 0,
"end": 0,
"name": "new_arr2",
"start": 0,
"type": "Identifier",
"type": "Identifier"
},
"property": {
"commentStart": 0,
"end": 0,
"raw": "0",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
},
"start": 0,
"type": "MemberExpression",
"type": "MemberExpression"
}
},
"start": 0,
"type": "ExpressionStatement",

View File

@ -2,6 +2,6 @@ arr = [1, 2, 3]
new_arr1 = pop(arr)
new_arr2 = pop(new_arr1)
new_arr3 = pop(new_arr2)
assertEqual(new_arr1[0], 1, 0.00001, "element 0 should not have changed")
assertEqual(new_arr1[1], 2, 0.00001, "element 1 should not have changed")
assertEqual(new_arr2[0], 1, 0.00001, "element 0 should not have changed")
assert(new_arr1[0], isEqualTo = 1, error = "element 0 should not have changed")
assert(new_arr1[1], isEqualTo = 2, error = "element 1 should not have changed")
assert(new_arr2[0], isEqualTo = 1, error = "element 0 should not have changed")

View File

@ -6,6 +6,6 @@ arr = [1, 2, 3]
new_arr1 = pop(arr)
new_arr2 = pop(new_arr1)
new_arr3 = pop(new_arr2)
assertEqual(new_arr1[0], 1, 0.00001, "element 0 should not have changed")
assertEqual(new_arr1[1], 2, 0.00001, "element 1 should not have changed")
assertEqual(new_arr2[0], 1, 0.00001, "element 0 should not have changed")
assert(new_arr1[0], isEqualTo = 1, error = "element 0 should not have changed")
assert(new_arr1[1], isEqualTo = 2, error = "element 1 should not have changed")
assert(new_arr2[0], isEqualTo = 1, error = "element 0 should not have changed")

File diff suppressed because it is too large Load Diff

View File

@ -1,12 +1,12 @@
arr = [1, 2, 3]
new_arr1 = push(arr, 4)
new_arr2 = push(new_arr1, 5)
assertEqual(new_arr1[0], 1, 0.00001, "element 0 should not have changed")
assertEqual(new_arr1[1], 2, 0.00001, "element 1 should not have changed")
assertEqual(new_arr1[2], 3, 0.00001, "element 2 should not have changed")
assertEqual(new_arr1[3], 4, 0.00001, "4 was added to the end of the array")
assertEqual(new_arr2[0], 1, 0.00001, "element 0 should not have changed")
assertEqual(new_arr2[1], 2, 0.00001, "element 1 should not have changed")
assertEqual(new_arr2[2], 3, 0.00001, "element 2 should not have changed")
assertEqual(new_arr2[3], 4, 0.00001, "4 was added to the end of the array")
assertEqual(new_arr2[4], 5, 0.00001, "5 was added to the end of the array")
assert(new_arr1[0], isEqualTo = 1, error = "element 0 should not have changed")
assert(new_arr1[1], isEqualTo = 2, error = "element 1 should not have changed")
assert(new_arr1[2], isEqualTo = 3, error = "element 2 should not have changed")
assert(new_arr1[3], isEqualTo = 4, error = "4 was added to the end of the array")
assert(new_arr2[0], isEqualTo = 1, error = "element 0 should not have changed")
assert(new_arr2[1], isEqualTo = 2, error = "element 1 should not have changed")
assert(new_arr2[2], isEqualTo = 3, error = "element 2 should not have changed")
assert(new_arr2[3], isEqualTo = 4, error = "4 was added to the end of the array")
assert(new_arr2[4], isEqualTo = 5, error = "5 was added to the end of the array")

View File

@ -5,12 +5,12 @@ description: Result of unparsing array_elem_push.kcl
arr = [1, 2, 3]
new_arr1 = push(arr, 4)
new_arr2 = push(new_arr1, 5)
assertEqual(new_arr1[0], 1, 0.00001, "element 0 should not have changed")
assertEqual(new_arr1[1], 2, 0.00001, "element 1 should not have changed")
assertEqual(new_arr1[2], 3, 0.00001, "element 2 should not have changed")
assertEqual(new_arr1[3], 4, 0.00001, "4 was added to the end of the array")
assertEqual(new_arr2[0], 1, 0.00001, "element 0 should not have changed")
assertEqual(new_arr2[1], 2, 0.00001, "element 1 should not have changed")
assertEqual(new_arr2[2], 3, 0.00001, "element 2 should not have changed")
assertEqual(new_arr2[3], 4, 0.00001, "4 was added to the end of the array")
assertEqual(new_arr2[4], 5, 0.00001, "5 was added to the end of the array")
assert(new_arr1[0], isEqualTo = 1, error = "element 0 should not have changed")
assert(new_arr1[1], isEqualTo = 2, error = "element 1 should not have changed")
assert(new_arr1[2], isEqualTo = 3, error = "element 2 should not have changed")
assert(new_arr1[3], isEqualTo = 4, error = "4 was added to the end of the array")
assert(new_arr2[0], isEqualTo = 1, error = "element 0 should not have changed")
assert(new_arr2[1], isEqualTo = 2, error = "element 1 should not have changed")
assert(new_arr2[2], isEqualTo = 3, error = "element 2 should not have changed")
assert(new_arr2[3], isEqualTo = 4, error = "4 was added to the end of the array")
assert(new_arr2[4], isEqualTo = 5, error = "5 was added to the end of the array")

View File

@ -1,5 +1,5 @@
---
source: kcl/src/simulation_tests.rs
source: kcl-lib/src/simulation_tests.rs
description: Error from executing array_elem_push_fail.kcl
---
KCL UndefinedValue error

File diff suppressed because it is too large Load Diff

View File

@ -1,17 +1,17 @@
r1 = [0..4]
assertEqual(r1[4], 4, 0.00001, "last element is included")
assert(r1[4], isEqualTo = 4, error = "last element is included")
four = 4
zero = 0
r2 = [zero..four]
assertEqual(r2[4], 4, 0.00001, "last element is included")
assert(r2[4], isEqualTo = 4, error = "last element is included")
five = int(four + 1)
r3 = [zero..five]
assertEqual(r3[4], 4, 0.00001, "second-to-last element is included")
assertEqual(r3[5], 5, 0.00001, "last element is included")
assert(r3[4], isEqualTo = 4, error = "second-to-last element is included")
assert(r3[5], isEqualTo = 5, error = "last element is included")
r4 = [int(zero + 1) .. int(five - 1)]
assertEqual(r4[0], 1, 0.00001, "first element is 1")
assertEqual(r4[2], 3, 0.00001, "second-to-last element is 3")
assertEqual(r4[3], 4, 0.00001, "last element is 4")
assert(r4[0], isEqualTo = 1, error = "first element is 1")
assert(r4[2], isEqualTo = 3, error = "second-to-last element is 3")
assert(r4[3], isEqualTo = 4, error = "last element is 4")

View File

@ -3,19 +3,19 @@ source: kcl-lib/src/simulation_tests.rs
description: Result of unparsing array_range_expr.kcl
---
r1 = [0..4]
assertEqual(r1[4], 4, 0.00001, "last element is included")
assert(r1[4], isEqualTo = 4, error = "last element is included")
four = 4
zero = 0
r2 = [zero..four]
assertEqual(r2[4], 4, 0.00001, "last element is included")
assert(r2[4], isEqualTo = 4, error = "last element is included")
five = int(four + 1)
r3 = [zero..five]
assertEqual(r3[4], 4, 0.00001, "second-to-last element is included")
assertEqual(r3[5], 5, 0.00001, "last element is included")
assert(r3[4], isEqualTo = 4, error = "second-to-last element is included")
assert(r3[5], isEqualTo = 5, error = "last element is included")
r4 = [int(zero + 1) .. int(five - 1)]
assertEqual(r4[0], 1, 0.00001, "first element is 1")
assertEqual(r4[2], 3, 0.00001, "second-to-last element is 3")
assertEqual(r4[3], 4, 0.00001, "last element is 4")
assert(r4[0], isEqualTo = 1, error = "first element is 1")
assert(r4[2], isEqualTo = 3, error = "second-to-last element is 3")
assert(r4[3], isEqualTo = 4, error = "last element is 4")

View File

@ -96,73 +96,53 @@ description: Result of parsing array_range_negative_expr.kcl
"expression": {
"arguments": [
{
"commentStart": 0,
"computed": false,
"end": 0,
"object": {
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "xs",
"name": "isEqualTo",
"start": 0,
"type": "Identifier",
"type": "Identifier"
},
"property": {
"arg": {
"argument": {
"commentStart": 0,
"end": 0,
"raw": "5",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 5.0,
"suffix": "None"
}
},
"commentStart": 0,
"end": 0,
"raw": "0",
"operator": "-",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
},
"start": 0,
"type": "MemberExpression",
"type": "MemberExpression"
},
{
"argument": {
"commentStart": 0,
"end": 0,
"raw": "5",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 5.0,
"suffix": "None"
}
},
"commentStart": 0,
"end": 0,
"operator": "-",
"start": 0,
"type": "UnaryExpression",
"type": "UnaryExpression"
},
{
"commentStart": 0,
"end": 0,
"raw": "0.001",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.001,
"suffix": "None"
"type": "UnaryExpression",
"type": "UnaryExpression"
}
},
{
"commentStart": 0,
"end": 0,
"raw": "\"first element is -5\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "first element is -5"
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "error",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 0,
"end": 0,
"raw": "\"first element is -5\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "first element is -5"
}
}
],
"callee": {
@ -172,7 +152,7 @@ description: Result of parsing array_range_negative_expr.kcl
"name": {
"commentStart": 0,
"end": 0,
"name": "assertEqual",
"name": "assert",
"start": 0,
"type": "Identifier"
},
@ -183,8 +163,36 @@ description: Result of parsing array_range_negative_expr.kcl
"commentStart": 0,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": {
"commentStart": 0,
"computed": false,
"end": 0,
"object": {
"commentStart": 0,
"end": 0,
"name": "xs",
"start": 0,
"type": "Identifier",
"type": "Identifier"
},
"property": {
"commentStart": 0,
"end": 0,
"raw": "0",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
},
"start": 0,
"type": "MemberExpression",
"type": "MemberExpression"
}
},
"start": 0,
"type": "ExpressionStatement",

View File

@ -1,2 +1,2 @@
xs = [int(-5) .. 5]
assertEqual(xs[0], -5, 0.001, "first element is -5")
assert(xs[0], isEqualTo = -5, error = "first element is -5")

View File

@ -3,4 +3,4 @@ source: kcl-lib/src/simulation_tests.rs
description: Result of unparsing array_range_negative_expr.kcl
---
xs = [int(-5) .. 5]
assertEqual(xs[0], -5, 0.001, "first element is -5")
assert(xs[0], isEqualTo = -5, error = "first element is -5")

View File

@ -156,26 +156,15 @@ description: Result of parsing boolean_logical_and.kcl
"expression": {
"arguments": [
{
"commentStart": 0,
"end": 0,
"left": {
"abs_path": false,
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "a",
"start": 0,
"type": "Identifier"
},
"path": [],
"name": "isEqualTo",
"start": 0,
"type": "Name",
"type": "Name"
"type": "Identifier"
},
"operator": "==",
"right": {
"arg": {
"commentStart": 0,
"end": 0,
"raw": "2",
@ -186,19 +175,26 @@ description: Result of parsing boolean_logical_and.kcl
"value": 2.0,
"suffix": "None"
}
},
"start": 0,
"type": "BinaryExpression",
"type": "BinaryExpression"
}
},
{
"commentStart": 0,
"end": 0,
"raw": "\"right branch of and is false makes the whole expression false\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "right branch of and is false makes the whole expression false"
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "error",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 0,
"end": 0,
"raw": "\"right branch of and is false makes the whole expression false\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "right branch of and is false makes the whole expression false"
}
}
],
"callee": {
@ -219,8 +215,24 @@ description: Result of parsing boolean_logical_and.kcl
"commentStart": 0,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": {
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "a",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
},
"start": 0,
"type": "ExpressionStatement",
@ -377,26 +389,15 @@ description: Result of parsing boolean_logical_and.kcl
"expression": {
"arguments": [
{
"commentStart": 0,
"end": 0,
"left": {
"abs_path": false,
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "b",
"start": 0,
"type": "Identifier"
},
"path": [],
"name": "isEqualTo",
"start": 0,
"type": "Name",
"type": "Name"
"type": "Identifier"
},
"operator": "==",
"right": {
"arg": {
"commentStart": 0,
"end": 0,
"raw": "2",
@ -407,19 +408,26 @@ description: Result of parsing boolean_logical_and.kcl
"value": 2.0,
"suffix": "None"
}
},
"start": 0,
"type": "BinaryExpression",
"type": "BinaryExpression"
}
},
{
"commentStart": 0,
"end": 0,
"raw": "\"left branch of and is false makes the whole expression false\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "left branch of and is false makes the whole expression false"
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "error",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 0,
"end": 0,
"raw": "\"left branch of and is false makes the whole expression false\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "left branch of and is false makes the whole expression false"
}
}
],
"callee": {
@ -440,8 +448,24 @@ description: Result of parsing boolean_logical_and.kcl
"commentStart": 0,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": {
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "b",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
},
"start": 0,
"type": "ExpressionStatement",
@ -598,26 +622,15 @@ description: Result of parsing boolean_logical_and.kcl
"expression": {
"arguments": [
{
"commentStart": 0,
"end": 0,
"left": {
"abs_path": false,
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "c",
"start": 0,
"type": "Identifier"
},
"path": [],
"name": "isEqualTo",
"start": 0,
"type": "Name",
"type": "Name"
"type": "Identifier"
},
"operator": "==",
"right": {
"arg": {
"commentStart": 0,
"end": 0,
"raw": "1",
@ -628,19 +641,26 @@ description: Result of parsing boolean_logical_and.kcl
"value": 1.0,
"suffix": "None"
}
},
"start": 0,
"type": "BinaryExpression",
"type": "BinaryExpression"
}
},
{
"commentStart": 0,
"end": 0,
"raw": "\"both branches of and are true makes the whole expression true\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "both branches of and are true makes the whole expression true"
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "error",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 0,
"end": 0,
"raw": "\"both branches of and are true makes the whole expression true\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "both branches of and are true makes the whole expression true"
}
}
],
"callee": {
@ -661,8 +681,24 @@ description: Result of parsing boolean_logical_and.kcl
"commentStart": 0,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": {
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "c",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
},
"start": 0,
"type": "ExpressionStatement",
@ -819,26 +855,15 @@ description: Result of parsing boolean_logical_and.kcl
"expression": {
"arguments": [
{
"commentStart": 0,
"end": 0,
"left": {
"abs_path": false,
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "d",
"start": 0,
"type": "Identifier"
},
"path": [],
"name": "isEqualTo",
"start": 0,
"type": "Name",
"type": "Name"
"type": "Identifier"
},
"operator": "==",
"right": {
"arg": {
"commentStart": 0,
"end": 0,
"raw": "2",
@ -849,19 +874,26 @@ description: Result of parsing boolean_logical_and.kcl
"value": 2.0,
"suffix": "None"
}
},
"start": 0,
"type": "BinaryExpression",
"type": "BinaryExpression"
}
},
{
"commentStart": 0,
"end": 0,
"raw": "\"both branches of and are false makes the whole expression false\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "both branches of and are false makes the whole expression false"
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "error",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 0,
"end": 0,
"raw": "\"both branches of and are false makes the whole expression false\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "both branches of and are false makes the whole expression false"
}
}
],
"callee": {
@ -882,8 +914,24 @@ description: Result of parsing boolean_logical_and.kcl
"commentStart": 0,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": {
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "d",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
},
"start": 0,
"type": "ExpressionStatement",

View File

@ -4,7 +4,7 @@ a = if aa {
} else {
2
}
assert(a == 2, "right branch of and is false makes the whole expression false")
assert(a, isEqualTo = 2, error = "right branch of and is false makes the whole expression false")
bb = false & true
b = if bb {
@ -12,7 +12,7 @@ b = if bb {
} else {
2
}
assert(b == 2, "left branch of and is false makes the whole expression false")
assert(b, isEqualTo = 2, error = "left branch of and is false makes the whole expression false")
cc = true & true
c = if cc {
@ -20,7 +20,7 @@ c = if cc {
} else {
2
}
assert(c == 1, "both branches of and are true makes the whole expression true")
assert(c, isEqualTo = 1, error = "both branches of and are true makes the whole expression true")
dd = false & false
d = if dd {
@ -28,4 +28,4 @@ d = if dd {
} else {
2
}
assert(d == 2, "both branches of and are false makes the whole expression false")
assert(d, isEqualTo = 2, error = "both branches of and are false makes the whole expression false")

View File

@ -8,7 +8,7 @@ a = if aa {
} else {
2
}
assert(a == 2, "right branch of and is false makes the whole expression false")
assert(a, isEqualTo = 2, error = "right branch of and is false makes the whole expression false")
bb = false & true
b = if bb {
@ -16,7 +16,7 @@ b = if bb {
} else {
2
}
assert(b == 2, "left branch of and is false makes the whole expression false")
assert(b, isEqualTo = 2, error = "left branch of and is false makes the whole expression false")
cc = true & true
c = if cc {
@ -24,7 +24,7 @@ c = if cc {
} else {
2
}
assert(c == 1, "both branches of and are true makes the whole expression true")
assert(c, isEqualTo = 1, error = "both branches of and are true makes the whole expression true")
dd = false & false
d = if dd {
@ -32,4 +32,4 @@ d = if dd {
} else {
2
}
assert(d == 2, "both branches of and are false makes the whole expression false")
assert(d, isEqualTo = 2, error = "both branches of and are false makes the whole expression false")

View File

@ -173,26 +173,15 @@ description: Result of parsing boolean_logical_multiple.kcl
"expression": {
"arguments": [
{
"commentStart": 0,
"end": 0,
"left": {
"abs_path": false,
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "i",
"start": 0,
"type": "Identifier"
},
"path": [],
"name": "isEqualTo",
"start": 0,
"type": "Name",
"type": "Name"
"type": "Identifier"
},
"operator": "==",
"right": {
"arg": {
"commentStart": 0,
"end": 0,
"raw": "1",
@ -203,19 +192,26 @@ description: Result of parsing boolean_logical_multiple.kcl
"value": 1.0,
"suffix": "None"
}
},
"start": 0,
"type": "BinaryExpression",
"type": "BinaryExpression"
}
},
{
"commentStart": 0,
"end": 0,
"raw": "\"and has higher precedence than or\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "and has higher precedence than or"
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "error",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 0,
"end": 0,
"raw": "\"and has higher precedence than or\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "and has higher precedence than or"
}
}
],
"callee": {
@ -236,8 +232,24 @@ description: Result of parsing boolean_logical_multiple.kcl
"commentStart": 0,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": {
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "i",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
},
"start": 0,
"type": "ExpressionStatement",
@ -453,26 +465,15 @@ description: Result of parsing boolean_logical_multiple.kcl
"expression": {
"arguments": [
{
"commentStart": 0,
"end": 0,
"left": {
"abs_path": false,
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "j",
"start": 0,
"type": "Identifier"
},
"path": [],
"name": "isEqualTo",
"start": 0,
"type": "Name",
"type": "Name"
"type": "Identifier"
},
"operator": "==",
"right": {
"arg": {
"commentStart": 0,
"end": 0,
"raw": "1",
@ -483,19 +484,26 @@ description: Result of parsing boolean_logical_multiple.kcl
"value": 1.0,
"suffix": "None"
}
},
"start": 0,
"type": "BinaryExpression",
"type": "BinaryExpression"
}
},
{
"commentStart": 0,
"end": 0,
"raw": "\"multiple logical operators\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "multiple logical operators"
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "error",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 0,
"end": 0,
"raw": "\"multiple logical operators\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "multiple logical operators"
}
}
],
"callee": {
@ -516,8 +524,24 @@ description: Result of parsing boolean_logical_multiple.kcl
"commentStart": 0,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": {
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "j",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
},
"start": 0,
"type": "ExpressionStatement",

View File

@ -4,7 +4,7 @@ i = if ii {
} else {
2
}
assert(i == 1, "and has higher precedence than or")
assert(i, isEqualTo = 1, error = "and has higher precedence than or")
jj = false | true & !false | false & true
j = if jj {
@ -12,4 +12,4 @@ j = if jj {
} else {
2
}
assert(j == 1, "multiple logical operators")
assert(j, isEqualTo = 1, error = "multiple logical operators")

View File

@ -8,7 +8,7 @@ i = if ii {
} else {
2
}
assert(i == 1, "and has higher precedence than or")
assert(i, isEqualTo = 1, error = "and has higher precedence than or")
jj = false | true & !false | false & true
j = if jj {
@ -16,4 +16,4 @@ j = if jj {
} else {
2
}
assert(j == 1, "multiple logical operators")
assert(j, isEqualTo = 1, error = "multiple logical operators")

View File

@ -156,26 +156,15 @@ description: Result of parsing boolean_logical_or.kcl
"expression": {
"arguments": [
{
"commentStart": 0,
"end": 0,
"left": {
"abs_path": false,
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "a",
"start": 0,
"type": "Identifier"
},
"path": [],
"name": "isEqualTo",
"start": 0,
"type": "Name",
"type": "Name"
"type": "Identifier"
},
"operator": "==",
"right": {
"arg": {
"commentStart": 0,
"end": 0,
"raw": "1",
@ -186,19 +175,26 @@ description: Result of parsing boolean_logical_or.kcl
"value": 1.0,
"suffix": "None"
}
},
"start": 0,
"type": "BinaryExpression",
"type": "BinaryExpression"
}
},
{
"commentStart": 0,
"end": 0,
"raw": "\"left branch of or is true makes the whole expression true\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "left branch of or is true makes the whole expression true"
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "error",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 0,
"end": 0,
"raw": "\"left branch of or is true makes the whole expression true\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "left branch of or is true makes the whole expression true"
}
}
],
"callee": {
@ -219,8 +215,24 @@ description: Result of parsing boolean_logical_or.kcl
"commentStart": 0,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": {
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "a",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
},
"start": 0,
"type": "ExpressionStatement",
@ -377,26 +389,15 @@ description: Result of parsing boolean_logical_or.kcl
"expression": {
"arguments": [
{
"commentStart": 0,
"end": 0,
"left": {
"abs_path": false,
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "b",
"start": 0,
"type": "Identifier"
},
"path": [],
"name": "isEqualTo",
"start": 0,
"type": "Name",
"type": "Name"
"type": "Identifier"
},
"operator": "==",
"right": {
"arg": {
"commentStart": 0,
"end": 0,
"raw": "1",
@ -407,19 +408,26 @@ description: Result of parsing boolean_logical_or.kcl
"value": 1.0,
"suffix": "None"
}
},
"start": 0,
"type": "BinaryExpression",
"type": "BinaryExpression"
}
},
{
"commentStart": 0,
"end": 0,
"raw": "\"right branch of or is true makes the whole expression true\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "right branch of or is true makes the whole expression true"
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "error",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 0,
"end": 0,
"raw": "\"right branch of or is true makes the whole expression true\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "right branch of or is true makes the whole expression true"
}
}
],
"callee": {
@ -440,8 +448,24 @@ description: Result of parsing boolean_logical_or.kcl
"commentStart": 0,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": {
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "b",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
},
"start": 0,
"type": "ExpressionStatement",
@ -598,26 +622,15 @@ description: Result of parsing boolean_logical_or.kcl
"expression": {
"arguments": [
{
"commentStart": 0,
"end": 0,
"left": {
"abs_path": false,
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "c",
"start": 0,
"type": "Identifier"
},
"path": [],
"name": "isEqualTo",
"start": 0,
"type": "Name",
"type": "Name"
"type": "Identifier"
},
"operator": "==",
"right": {
"arg": {
"commentStart": 0,
"end": 0,
"raw": "1",
@ -628,19 +641,26 @@ description: Result of parsing boolean_logical_or.kcl
"value": 1.0,
"suffix": "None"
}
},
"start": 0,
"type": "BinaryExpression",
"type": "BinaryExpression"
}
},
{
"commentStart": 0,
"end": 0,
"raw": "\"both branches of or are true makes the whole expression true\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "both branches of or are true makes the whole expression true"
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "error",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 0,
"end": 0,
"raw": "\"both branches of or are true makes the whole expression true\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "both branches of or are true makes the whole expression true"
}
}
],
"callee": {
@ -661,8 +681,24 @@ description: Result of parsing boolean_logical_or.kcl
"commentStart": 0,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": {
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "c",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
},
"start": 0,
"type": "ExpressionStatement",
@ -819,26 +855,15 @@ description: Result of parsing boolean_logical_or.kcl
"expression": {
"arguments": [
{
"commentStart": 0,
"end": 0,
"left": {
"abs_path": false,
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "d",
"start": 0,
"type": "Identifier"
},
"path": [],
"name": "isEqualTo",
"start": 0,
"type": "Name",
"type": "Name"
"type": "Identifier"
},
"operator": "==",
"right": {
"arg": {
"commentStart": 0,
"end": 0,
"raw": "2",
@ -849,19 +874,26 @@ description: Result of parsing boolean_logical_or.kcl
"value": 2.0,
"suffix": "None"
}
},
"start": 0,
"type": "BinaryExpression",
"type": "BinaryExpression"
}
},
{
"commentStart": 0,
"end": 0,
"raw": "\"both branches of or are false makes the whole expression false\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "both branches of or are false makes the whole expression false"
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "error",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 0,
"end": 0,
"raw": "\"both branches of or are false makes the whole expression false\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "both branches of or are false makes the whole expression false"
}
}
],
"callee": {
@ -882,8 +914,24 @@ description: Result of parsing boolean_logical_or.kcl
"commentStart": 0,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": {
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "d",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
},
"start": 0,
"type": "ExpressionStatement",

View File

@ -4,7 +4,7 @@ a = if aa {
} else {
2
}
assert(a == 1, "left branch of or is true makes the whole expression true")
assert(a, isEqualTo = 1, error = "left branch of or is true makes the whole expression true")
bb = false | true
b = if bb {
@ -12,7 +12,7 @@ b = if bb {
} else {
2
}
assert(b == 1, "right branch of or is true makes the whole expression true")
assert(b, isEqualTo = 1, error = "right branch of or is true makes the whole expression true")
cc = true | true
c = if cc {
@ -20,7 +20,7 @@ c = if cc {
} else {
2
}
assert(c == 1, "both branches of or are true makes the whole expression true")
assert(c, isEqualTo = 1, error = "both branches of or are true makes the whole expression true")
dd = false | false
d = if dd {
@ -28,4 +28,4 @@ d = if dd {
} else {
2
}
assert(d == 2, "both branches of or are false makes the whole expression false")
assert(d, isEqualTo = 2, error = "both branches of or are false makes the whole expression false")

View File

@ -8,7 +8,7 @@ a = if aa {
} else {
2
}
assert(a == 1, "left branch of or is true makes the whole expression true")
assert(a, isEqualTo = 1, error = "left branch of or is true makes the whole expression true")
bb = false | true
b = if bb {
@ -16,7 +16,7 @@ b = if bb {
} else {
2
}
assert(b == 1, "right branch of or is true makes the whole expression true")
assert(b, isEqualTo = 1, error = "right branch of or is true makes the whole expression true")
cc = true | true
c = if cc {
@ -24,7 +24,7 @@ c = if cc {
} else {
2
}
assert(c == 1, "both branches of or are true makes the whole expression true")
assert(c, isEqualTo = 1, error = "both branches of or are true makes the whole expression true")
dd = false | false
d = if dd {
@ -32,4 +32,4 @@ d = if dd {
} else {
2
}
assert(d == 2, "both branches of or are false makes the whole expression false")
assert(d, isEqualTo = 2, error = "both branches of or are false makes the whole expression false")

File diff suppressed because it is too large Load Diff

View File

@ -1,13 +1,11 @@
assert(3 == 3, "equality")
assert(3.0 == 3.0, "equality of floats")
assert(3 != 4, "non-equality")
assert(3.0 != 4.0, "non-equality of floats")
assert(3 < 4, "lt")
assert(3 <= 4, "lte but actually lt")
assert(4 <= 4, "lte but actually eq")
assert(4 > 3, "gt")
assert(4 >= 3, "gte but actually gt")
assert(3 >= 3, "gte but actually eq")
assert(3, isEqualTo = 3, error = "equality")
assert(3.0, isEqualTo = 3.0, error = "equality of floats")
assert(3, isLessThan = 4, error = "lt")
assert(3, isLessThanOrEqual = 4, error = "lte but actually lt")
assert(4, isLessThanOrEqual = 4, error = "lte but actually eq")
assert(4, isGreaterThan = 3, error = "gt")
assert(4, isGreaterThanOrEqual = 3, error = "gte but actually gt")
assert(3, isGreaterThanOrEqual = 3, error = "gte but actually eq")
assert(0.0 == 0.0, "equality of zero")
assert(0.0 == -0.0, "equality of zero and neg zero")
assert(0.0, isEqualTo = 0.0, error = "equality of zero")
assert(0.0, isEqualTo = -0.0, error = "equality of zero and neg zero")

View File

@ -2,16 +2,14 @@
source: kcl-lib/src/simulation_tests.rs
description: Result of unparsing comparisons.kcl
---
assert(3 == 3, "equality")
assert(3.0 == 3.0, "equality of floats")
assert(3 != 4, "non-equality")
assert(3.0 != 4.0, "non-equality of floats")
assert(3 < 4, "lt")
assert(3 <= 4, "lte but actually lt")
assert(4 <= 4, "lte but actually eq")
assert(4 > 3, "gt")
assert(4 >= 3, "gte but actually gt")
assert(3 >= 3, "gte but actually eq")
assert(3, isEqualTo = 3, error = "equality")
assert(3.0, isEqualTo = 3.0, error = "equality of floats")
assert(3, isLessThan = 4, error = "lt")
assert(3, isLessThanOrEqual = 4, error = "lte but actually lt")
assert(4, isLessThanOrEqual = 4, error = "lte but actually eq")
assert(4, isGreaterThan = 3, error = "gt")
assert(4, isGreaterThanOrEqual = 3, error = "gte but actually gt")
assert(3, isGreaterThanOrEqual = 3, error = "gte but actually eq")
assert(0.0 == 0.0, "equality of zero")
assert(0.0 == -0.0, "equality of zero and neg zero")
assert(0.0, isEqualTo = 0.0, error = "equality of zero")
assert(0.0, isEqualTo = -0.0, error = "equality of zero and neg zero")

View File

@ -11,65 +11,23 @@ description: Result of parsing comparisons_multiple.kcl
"expression": {
"arguments": [
{
"commentStart": 0,
"end": 0,
"left": {
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"left": {
"commentStart": 0,
"end": 0,
"raw": "3",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 3.0,
"suffix": "None"
}
},
"operator": "==",
"right": {
"commentStart": 0,
"end": 0,
"raw": "3",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 3.0,
"suffix": "None"
}
},
"name": "error",
"start": 0,
"type": "BinaryExpression",
"type": "BinaryExpression"
"type": "Identifier"
},
"operator": "==",
"right": {
"arg": {
"commentStart": 0,
"end": 0,
"raw": "3",
"raw": "\"this should not compile\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 3.0,
"suffix": "None"
}
},
"start": 0,
"type": "BinaryExpression",
"type": "BinaryExpression"
},
{
"commentStart": 0,
"end": 0,
"raw": "\"this should not compile\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "this should not compile"
"value": "this should not compile"
}
}
],
"callee": {
@ -90,8 +48,60 @@ description: Result of parsing comparisons_multiple.kcl
"commentStart": 0,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": {
"commentStart": 0,
"end": 0,
"left": {
"commentStart": 0,
"end": 0,
"left": {
"commentStart": 0,
"end": 0,
"raw": "3",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 3.0,
"suffix": "None"
}
},
"operator": "==",
"right": {
"commentStart": 0,
"end": 0,
"raw": "3",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 3.0,
"suffix": "None"
}
},
"start": 0,
"type": "BinaryExpression",
"type": "BinaryExpression"
},
"operator": "==",
"right": {
"commentStart": 0,
"end": 0,
"raw": "3",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 3.0,
"suffix": "None"
}
},
"start": 0,
"type": "BinaryExpression",
"type": "BinaryExpression"
}
},
"start": 0,
"type": "ExpressionStatement",

View File

@ -1,12 +1,12 @@
---
source: kcl/src/simulation_tests.rs
source: kcl-lib/src/simulation_tests.rs
description: Error from executing comparisons_multiple.kcl
---
KCL Semantic error
× semantic: Expected a number, but found a boolean (true/false value)
╭────
1 │ assert(3 == 3 == 3, "this should not compile")
1 │ assert(3 == 3 == 3, error = "this should not compile")
· ───┬──
· ╰── tests/comparisons_multiple/input.kcl
╰────

View File

@ -1 +1 @@
assert(3 == 3 == 3, "this should not compile")
assert(3 == 3 == 3, error = "this should not compile")

View File

@ -2,4 +2,4 @@
source: kcl-lib/src/simulation_tests.rs
description: Result of unparsing comparisons_multiple.kcl
---
assert(3 == 3 == 3, "this should not compile")
assert(3 == 3 == 3, error = "this should not compile")

View File

@ -167,53 +167,45 @@ description: Result of parsing computed_var.kcl
"expression": {
"arguments": [
{
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "ten",
"name": "isEqualTo",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
{
"commentStart": 0,
"end": 0,
"raw": "10",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 10.0,
"suffix": "None"
"arg": {
"commentStart": 0,
"end": 0,
"raw": "10",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 10.0,
"suffix": "None"
}
}
},
{
"commentStart": 0,
"end": 0,
"raw": "0.000001",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.000001,
"suffix": "None"
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "error",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 0,
"end": 0,
"raw": "\"oops\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "oops"
}
},
{
"commentStart": 0,
"end": 0,
"raw": "\"oops\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "oops"
}
],
"callee": {
@ -223,7 +215,7 @@ description: Result of parsing computed_var.kcl
"name": {
"commentStart": 0,
"end": 0,
"name": "assertEqual",
"name": "assert",
"start": 0,
"type": "Identifier"
},
@ -234,8 +226,24 @@ description: Result of parsing computed_var.kcl
"commentStart": 0,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": {
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "ten",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
},
"start": 0,
"type": "ExpressionStatement",
@ -402,53 +410,45 @@ description: Result of parsing computed_var.kcl
"expression": {
"arguments": [
{
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "one",
"name": "isEqualTo",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
{
"commentStart": 0,
"end": 0,
"raw": "1",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
"arg": {
"commentStart": 0,
"end": 0,
"raw": "1",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
}
}
},
{
"commentStart": 0,
"end": 0,
"raw": "0.0000001",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0000001,
"suffix": "None"
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "error",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 0,
"end": 0,
"raw": "\"oops\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "oops"
}
},
{
"commentStart": 0,
"end": 0,
"raw": "\"oops\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "oops"
}
],
"callee": {
@ -458,7 +458,7 @@ description: Result of parsing computed_var.kcl
"name": {
"commentStart": 0,
"end": 0,
"name": "assertEqual",
"name": "assert",
"start": 0,
"type": "Identifier"
},
@ -469,8 +469,24 @@ description: Result of parsing computed_var.kcl
"commentStart": 0,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": {
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "one",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
},
"start": 0,
"type": "ExpressionStatement",
@ -482,53 +498,67 @@ description: Result of parsing computed_var.kcl
"expression": {
"arguments": [
{
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "PI",
"name": "isEqualTo",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
{
"commentStart": 0,
"end": 0,
"raw": "3",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 3.0,
"suffix": "None"
"arg": {
"commentStart": 0,
"end": 0,
"raw": "3",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 3.0,
"suffix": "None"
}
}
},
{
"commentStart": 0,
"end": 0,
"raw": "0.2",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.2,
"suffix": "None"
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "tolerance",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 0,
"end": 0,
"raw": "0.2",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.2,
"suffix": "None"
}
}
},
{
"commentStart": 0,
"end": 0,
"raw": "\"oops pi\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "oops pi"
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "error",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 0,
"end": 0,
"raw": "\"oops pi\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "oops pi"
}
}
],
"callee": {
@ -538,7 +568,7 @@ description: Result of parsing computed_var.kcl
"name": {
"commentStart": 0,
"end": 0,
"name": "assertEqual",
"name": "assert",
"start": 0,
"type": "Identifier"
},
@ -549,8 +579,24 @@ description: Result of parsing computed_var.kcl
"commentStart": 0,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": {
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "PI",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
},
"start": 0,
"type": "ExpressionStatement",
@ -643,53 +689,67 @@ description: Result of parsing computed_var.kcl
"expression": {
"arguments": [
{
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "x",
"name": "isEqualTo",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
{
"commentStart": 0,
"end": 0,
"raw": "1",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
"arg": {
"commentStart": 0,
"end": 0,
"raw": "1",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
}
}
},
{
"commentStart": 0,
"end": 0,
"raw": "0.000001",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.000001,
"suffix": "None"
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "tolerance",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 0,
"end": 0,
"raw": "0.000001",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.000001,
"suffix": "None"
}
}
},
{
"commentStart": 0,
"end": 0,
"raw": "\"oops cos\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "oops cos"
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "error",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 0,
"end": 0,
"raw": "\"oops cos\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "oops cos"
}
}
],
"callee": {
@ -699,7 +759,7 @@ description: Result of parsing computed_var.kcl
"name": {
"commentStart": 0,
"end": 0,
"name": "assertEqual",
"name": "assert",
"start": 0,
"type": "Identifier"
},
@ -710,8 +770,24 @@ description: Result of parsing computed_var.kcl
"commentStart": 0,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": {
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "x",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
},
"start": 0,
"type": "ExpressionStatement",
@ -765,6 +841,17 @@ description: Result of parsing computed_var.kcl
"type": "newLine"
}
}
],
"8": [
{
"commentStart": 0,
"end": 0,
"start": 0,
"type": "NonCodeNode",
"value": {
"type": "newLine"
}
}
]
},
"startNodes": [

View File

@ -5,14 +5,15 @@ arr = [0, 0, 0, 10]
i = 3
ten = arr[i]
assertEqual(ten, 10, 0.000001, "oops")
assert(ten, isEqualTo = 10, error = "oops")
p = "foo"
obj = { foo = 1, bar = 0 }
one = obj[p]
assertEqual(one, 1, 0.0000001, "oops")
assert(one, isEqualTo = 1, error = "oops")
assert(PI, isEqualTo = 3, tolerance = 0.2, error = "oops pi")
assertEqual(PI, 3, 0.2, "oops pi")
x = cos(2 * PI)
assertEqual(x, 1, 0.000001, "oops cos")
assert(x, isEqualTo = 1, tolerance = 0.000001, error = "oops cos")

View File

@ -9,14 +9,25 @@ arr = [0, 0, 0, 10]
i = 3
ten = arr[i]
assertEqual(ten, 10, 0.000001, "oops")
assert(ten, isEqualTo = 10, error = "oops")
p = "foo"
obj = { foo = 1, bar = 0 }
one = obj[p]
assertEqual(one, 1, 0.0000001, "oops")
assert(one, isEqualTo = 1, error = "oops")
assert(
PI,
isEqualTo = 3,
tolerance = 0.2,
error = "oops pi",
)
assertEqual(PI, 3, 0.2, "oops pi")
x = cos(2 * PI)
assertEqual(x, 1, 0.000001, "oops cos")
assert(
x,
isEqualTo = 1,
tolerance = 0.000001,
error = "oops cos",
)

View File

@ -145,53 +145,45 @@ description: Result of parsing if_else.kcl
"expression": {
"arguments": [
{
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "a",
"name": "isEqualTo",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
{
"commentStart": 0,
"end": 0,
"raw": "3",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 3.0,
"suffix": "None"
"arg": {
"commentStart": 0,
"end": 0,
"raw": "3",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 3.0,
"suffix": "None"
}
}
},
{
"commentStart": 0,
"end": 0,
"raw": "0.001",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.001,
"suffix": "None"
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "error",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 0,
"end": 0,
"raw": "\"the 'if' branch gets returned\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "the 'if' branch gets returned"
}
},
{
"commentStart": 0,
"end": 0,
"raw": "\"the 'if' branch gets returned\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "the 'if' branch gets returned"
}
],
"callee": {
@ -201,7 +193,7 @@ description: Result of parsing if_else.kcl
"name": {
"commentStart": 0,
"end": 0,
"name": "assertEqual",
"name": "assert",
"start": 0,
"type": "Identifier"
},
@ -212,8 +204,24 @@ description: Result of parsing if_else.kcl
"commentStart": 0,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": {
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "a",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
},
"start": 0,
"type": "ExpressionStatement",
@ -359,53 +367,45 @@ description: Result of parsing if_else.kcl
"expression": {
"arguments": [
{
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "b",
"name": "isEqualTo",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
{
"commentStart": 0,
"end": 0,
"raw": "4",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 4.0,
"suffix": "None"
"arg": {
"commentStart": 0,
"end": 0,
"raw": "4",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 4.0,
"suffix": "None"
}
}
},
{
"commentStart": 0,
"end": 0,
"raw": "0.001",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.001,
"suffix": "None"
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "error",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 0,
"end": 0,
"raw": "\"the 'else if' branch gets returned\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "the 'else if' branch gets returned"
}
},
{
"commentStart": 0,
"end": 0,
"raw": "\"the 'else if' branch gets returned\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "the 'else if' branch gets returned"
}
],
"callee": {
@ -415,7 +415,7 @@ description: Result of parsing if_else.kcl
"name": {
"commentStart": 0,
"end": 0,
"name": "assertEqual",
"name": "assert",
"start": 0,
"type": "Identifier"
},
@ -426,8 +426,24 @@ description: Result of parsing if_else.kcl
"commentStart": 0,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": {
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "b",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
},
"start": 0,
"type": "ExpressionStatement",
@ -573,53 +589,45 @@ description: Result of parsing if_else.kcl
"expression": {
"arguments": [
{
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "c",
"name": "isEqualTo",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
{
"commentStart": 0,
"end": 0,
"raw": "5",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 5.0,
"suffix": "None"
"arg": {
"commentStart": 0,
"end": 0,
"raw": "5",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 5.0,
"suffix": "None"
}
}
},
{
"commentStart": 0,
"end": 0,
"raw": "0.001",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.001,
"suffix": "None"
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "error",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 0,
"end": 0,
"raw": "\"the 'else' branch gets returned\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "the 'else' branch gets returned"
}
},
{
"commentStart": 0,
"end": 0,
"raw": "\"the 'else' branch gets returned\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "the 'else' branch gets returned"
}
],
"callee": {
@ -629,7 +637,7 @@ description: Result of parsing if_else.kcl
"name": {
"commentStart": 0,
"end": 0,
"name": "assertEqual",
"name": "assert",
"start": 0,
"type": "Identifier"
},
@ -640,8 +648,24 @@ description: Result of parsing if_else.kcl
"commentStart": 0,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": {
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "c",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
},
"start": 0,
"type": "ExpressionStatement",

View File

@ -8,7 +8,7 @@ a = if true {
} else {
5
}
assertEqual(a, 3, 0.001, "the 'if' branch gets returned")
assert(a, isEqualTo = 3, error = "the 'if' branch gets returned")
b = if false {
3
@ -17,7 +17,7 @@ b = if false {
} else {
5
}
assertEqual(b, 4, 0.001, "the 'else if' branch gets returned")
assert(b, isEqualTo = 4, error = "the 'else if' branch gets returned")
c = if false {
3
@ -26,4 +26,4 @@ c = if false {
} else {
5
}
assertEqual(c, 5, 0.001, "the 'else' branch gets returned")
assert(c, isEqualTo = 5, error = "the 'else' branch gets returned")

View File

@ -12,7 +12,7 @@ a = if true {
} else {
5
}
assertEqual(a, 3, 0.001, "the 'if' branch gets returned")
assert(a, isEqualTo = 3, error = "the 'if' branch gets returned")
b = if false {
3
@ -21,7 +21,7 @@ b = if false {
} else {
5
}
assertEqual(b, 4, 0.001, "the 'else if' branch gets returned")
assert(b, isEqualTo = 4, error = "the 'else if' branch gets returned")
c = if false {
3
@ -30,4 +30,4 @@ c = if false {
} else {
5
}
assertEqual(c, 5, 0.001, "the 'else' branch gets returned")
assert(c, isEqualTo = 5, error = "the 'else' branch gets returned")

View File

@ -126,41 +126,45 @@ description: Result of parsing index_of_array.kcl
"expression": {
"arguments": [
{
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "result0",
"name": "isLessThanOrEqual",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
{
"commentStart": 0,
"end": 0,
"raw": "91",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 91.0,
"suffix": "None"
"arg": {
"commentStart": 0,
"end": 0,
"raw": "91",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 91.0,
"suffix": "None"
}
}
},
{
"commentStart": 0,
"end": 0,
"raw": "\"Literal property lookup\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "Literal property lookup"
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "error",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 0,
"end": 0,
"raw": "\"Literal property lookup\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "Literal property lookup"
}
}
],
"callee": {
@ -170,7 +174,7 @@ description: Result of parsing index_of_array.kcl
"name": {
"commentStart": 0,
"end": 0,
"name": "assertLessThanOrEq",
"name": "assert",
"start": 0,
"type": "Identifier"
},
@ -181,8 +185,24 @@ description: Result of parsing index_of_array.kcl
"commentStart": 0,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": {
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "result0",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
},
"start": 0,
"type": "ExpressionStatement",
@ -194,41 +214,45 @@ description: Result of parsing index_of_array.kcl
"expression": {
"arguments": [
{
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "result0",
"name": "isGreaterThanOrEqual",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
{
"commentStart": 0,
"end": 0,
"raw": "91",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 91.0,
"suffix": "None"
"arg": {
"commentStart": 0,
"end": 0,
"raw": "91",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 91.0,
"suffix": "None"
}
}
},
{
"commentStart": 0,
"end": 0,
"raw": "\"Literal property lookup\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "Literal property lookup"
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "error",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 0,
"end": 0,
"raw": "\"Literal property lookup\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "Literal property lookup"
}
}
],
"callee": {
@ -238,7 +262,7 @@ description: Result of parsing index_of_array.kcl
"name": {
"commentStart": 0,
"end": 0,
"name": "assertGreaterThanOrEq",
"name": "assert",
"start": 0,
"type": "Identifier"
},
@ -249,8 +273,24 @@ description: Result of parsing index_of_array.kcl
"commentStart": 0,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": {
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "result0",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
},
"start": 0,
"type": "ExpressionStatement",
@ -384,41 +424,45 @@ description: Result of parsing index_of_array.kcl
"expression": {
"arguments": [
{
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "result1",
"name": "isLessThanOrEqual",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
{
"commentStart": 0,
"end": 0,
"raw": "91",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 91.0,
"suffix": "None"
"arg": {
"commentStart": 0,
"end": 0,
"raw": "91",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 91.0,
"suffix": "None"
}
}
},
{
"commentStart": 0,
"end": 0,
"raw": "\"Computed property lookup\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "Computed property lookup"
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "error",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 0,
"end": 0,
"raw": "\"Computed property lookup\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "Computed property lookup"
}
}
],
"callee": {
@ -428,7 +472,7 @@ description: Result of parsing index_of_array.kcl
"name": {
"commentStart": 0,
"end": 0,
"name": "assertLessThanOrEq",
"name": "assert",
"start": 0,
"type": "Identifier"
},
@ -439,8 +483,24 @@ description: Result of parsing index_of_array.kcl
"commentStart": 0,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": {
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "result1",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
},
"start": 0,
"type": "ExpressionStatement",
@ -452,41 +512,45 @@ description: Result of parsing index_of_array.kcl
"expression": {
"arguments": [
{
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "result1",
"name": "isGreaterThanOrEqual",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
{
"commentStart": 0,
"end": 0,
"raw": "91",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 91.0,
"suffix": "None"
"arg": {
"commentStart": 0,
"end": 0,
"raw": "91",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 91.0,
"suffix": "None"
}
}
},
{
"commentStart": 0,
"end": 0,
"raw": "\"Computed property lookup\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "Computed property lookup"
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "error",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 0,
"end": 0,
"raw": "\"Computed property lookup\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "Computed property lookup"
}
}
],
"callee": {
@ -496,7 +560,7 @@ description: Result of parsing index_of_array.kcl
"name": {
"commentStart": 0,
"end": 0,
"name": "assertGreaterThanOrEq",
"name": "assert",
"start": 0,
"type": "Identifier"
},
@ -507,8 +571,24 @@ description: Result of parsing index_of_array.kcl
"commentStart": 0,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": {
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "result1",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
},
"start": 0,
"type": "ExpressionStatement",

View File

@ -8,8 +8,8 @@ arr = [90, 91, 92]
result0 = arr[1]
assertLessThanOrEq(result0, 91, "Literal property lookup")
assertGreaterThanOrEq(result0, 91, "Literal property lookup")
assert(result0, isLessThanOrEqual = 91, error = "Literal property lookup")
assert(result0, isGreaterThanOrEqual = 91, error = "Literal property lookup")
// Test: computed index.
@ -17,5 +17,5 @@ assertGreaterThanOrEq(result0, 91, "Literal property lookup")
i = int(1 + 0)
result1 = arr[i]
assertLessThanOrEq(result1, 91, "Computed property lookup")
assertGreaterThanOrEq(result1, 91, "Computed property lookup")
assert(result1, isLessThanOrEqual = 91, error = "Computed property lookup")
assert(result1, isGreaterThanOrEqual = 91, error = "Computed property lookup")

View File

@ -12,8 +12,8 @@ arr = [90, 91, 92]
result0 = arr[1]
assertLessThanOrEq(result0, 91, "Literal property lookup")
assertGreaterThanOrEq(result0, 91, "Literal property lookup")
assert(result0, isLessThanOrEqual = 91, error = "Literal property lookup")
assert(result0, isGreaterThanOrEqual = 91, error = "Literal property lookup")
// Test: computed index.
@ -21,5 +21,5 @@ assertGreaterThanOrEq(result0, 91, "Literal property lookup")
i = int(1 + 0)
result1 = arr[i]
assertLessThanOrEq(result1, 91, "Computed property lookup")
assertGreaterThanOrEq(result1, 91, "Computed property lookup")
assert(result1, isLessThanOrEqual = 91, error = "Computed property lookup")
assert(result1, isGreaterThanOrEqual = 91, error = "Computed property lookup")

View File

@ -1,28 +1,28 @@
```mermaid
flowchart LR
subgraph path2 [Path]
2["Path<br>[2001, 2026, 0]"]
3["Segment<br>[2032, 2090, 0]"]
4["Segment<br>[2096, 2135, 0]"]
5["Segment<br>[2141, 2188, 0]"]
6["Segment<br>[2194, 2240, 0]"]
7["Segment<br>[2246, 2285, 0]"]
8["Segment<br>[2291, 2361, 0]"]
9["Segment<br>[2367, 2374, 0]"]
2["Path<br>[2065, 2090, 0]"]
3["Segment<br>[2096, 2154, 0]"]
4["Segment<br>[2160, 2199, 0]"]
5["Segment<br>[2205, 2252, 0]"]
6["Segment<br>[2258, 2304, 0]"]
7["Segment<br>[2310, 2349, 0]"]
8["Segment<br>[2355, 2425, 0]"]
9["Segment<br>[2431, 2438, 0]"]
10[Solid2d]
end
subgraph path32 [Path]
32["Path<br>[2519, 2709, 0]"]
33["Segment<br>[2519, 2709, 0]"]
32["Path<br>[2583, 2773, 0]"]
33["Segment<br>[2583, 2773, 0]"]
34[Solid2d]
end
subgraph path42 [Path]
42["Path<br>[3143, 3345, 0]"]
43["Segment<br>[3143, 3345, 0]"]
42["Path<br>[3207, 3409, 0]"]
43["Segment<br>[3207, 3409, 0]"]
44[Solid2d]
end
1["Plane<br>[1978, 1995, 0]"]
11["Sweep Extrusion<br>[2380, 2406, 0]"]
1["Plane<br>[2042, 2059, 0]"]
11["Sweep Extrusion<br>[2444, 2470, 0]"]
12[Wall]
13[Wall]
14[Wall]
@ -43,26 +43,26 @@ flowchart LR
29["SweepEdge Adjacent"]
30["SweepEdge Opposite"]
31["SweepEdge Adjacent"]
35["Sweep Extrusion<br>[2995, 3032, 0]"]
35["Sweep Extrusion<br>[3059, 3096, 0]"]
36[Wall]
37["SweepEdge Opposite"]
38["SweepEdge Adjacent"]
39["Sweep Extrusion<br>[2995, 3032, 0]"]
40["Sweep Extrusion<br>[2995, 3032, 0]"]
41["Sweep Extrusion<br>[2995, 3032, 0]"]
45["Sweep Extrusion<br>[3460, 3497, 0]"]
39["Sweep Extrusion<br>[3059, 3096, 0]"]
40["Sweep Extrusion<br>[3059, 3096, 0]"]
41["Sweep Extrusion<br>[3059, 3096, 0]"]
45["Sweep Extrusion<br>[3524, 3561, 0]"]
46[Wall]
47["SweepEdge Opposite"]
48["SweepEdge Adjacent"]
49["Sweep Extrusion<br>[3460, 3497, 0]"]
50["EdgeCut Fillet<br>[3514, 3594, 0]"]
51["EdgeCut Fillet<br>[3595, 3672, 0]"]
52["EdgeCut Fillet<br>[3698, 3840, 0]"]
53["EdgeCut Fillet<br>[3698, 3840, 0]"]
54["EdgeCut Fillet<br>[3698, 3840, 0]"]
55["EdgeCut Fillet<br>[3698, 3840, 0]"]
56["StartSketchOnFace<br>[2473, 2513, 0]"]
57["StartSketchOnFace<br>[3097, 3137, 0]"]
49["Sweep Extrusion<br>[3524, 3561, 0]"]
50["EdgeCut Fillet<br>[3578, 3658, 0]"]
51["EdgeCut Fillet<br>[3659, 3736, 0]"]
52["EdgeCut Fillet<br>[3762, 3904, 0]"]
53["EdgeCut Fillet<br>[3762, 3904, 0]"]
54["EdgeCut Fillet<br>[3762, 3904, 0]"]
55["EdgeCut Fillet<br>[3762, 3904, 0]"]
56["StartSketchOnFace<br>[2537, 2577, 0]"]
57["StartSketchOnFace<br>[3161, 3201, 0]"]
1 --- 2
2 --- 3
2 --- 4

View File

@ -771,65 +771,69 @@ description: Result of parsing bracket.kcl
"expression": {
"arguments": [
{
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "wallMountLength",
"name": "isGreaterThanOrEqual",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
{
"commentStart": 0,
"end": 0,
"left": {
"abs_path": false,
"arg": {
"commentStart": 0,
"end": 0,
"name": {
"left": {
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": "wallMountingHoleDiameter",
"name": {
"commentStart": 0,
"end": 0,
"name": "wallMountingHoleDiameter",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Identifier"
"type": "Name",
"type": "Name"
},
"operator": "*",
"right": {
"commentStart": 0,
"end": 0,
"raw": "3",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 3.0,
"suffix": "None"
}
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
"operator": "*",
"right": {
"commentStart": 0,
"end": 0,
"raw": "3",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 3.0,
"suffix": "None"
}
},
"start": 0,
"type": "BinaryExpression",
"type": "BinaryExpression"
"type": "BinaryExpression",
"type": "BinaryExpression"
}
},
{
"commentStart": 0,
"end": 0,
"raw": "\"Holes not possible. Either decrease hole diameter or increase wallMountLength\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "Holes not possible. Either decrease hole diameter or increase wallMountLength"
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "error",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 0,
"end": 0,
"raw": "\"Holes not possible. Either decrease hole diameter or increase wallMountLength\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "Holes not possible. Either decrease hole diameter or increase wallMountLength"
}
}
],
"callee": {
@ -839,7 +843,7 @@ description: Result of parsing bracket.kcl
"name": {
"commentStart": 0,
"end": 0,
"name": "assertGreaterThanOrEq",
"name": "assert",
"start": 0,
"type": "Identifier"
},
@ -850,8 +854,24 @@ description: Result of parsing bracket.kcl
"commentStart": 0,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": {
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "wallMountLength",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
},
"preComments": [
"",
@ -868,65 +888,69 @@ description: Result of parsing bracket.kcl
"expression": {
"arguments": [
{
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "shelfMountLength",
"name": "isGreaterThanOrEqual",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
{
"commentStart": 0,
"end": 0,
"left": {
"abs_path": false,
"arg": {
"commentStart": 0,
"end": 0,
"name": {
"left": {
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": "shelfMountingHoleDiameter",
"name": {
"commentStart": 0,
"end": 0,
"name": "shelfMountingHoleDiameter",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Identifier"
"type": "Name",
"type": "Name"
},
"operator": "*",
"right": {
"commentStart": 0,
"end": 0,
"raw": "5.5",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 5.5,
"suffix": "None"
}
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
"operator": "*",
"right": {
"commentStart": 0,
"end": 0,
"raw": "5.5",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 5.5,
"suffix": "None"
}
},
"start": 0,
"type": "BinaryExpression",
"type": "BinaryExpression"
"type": "BinaryExpression",
"type": "BinaryExpression"
}
},
{
"commentStart": 0,
"end": 0,
"raw": "\"wallMountLength must be longer for hole sizes to work. Either decrease mounting hole diameters or increase shelfMountLength\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "wallMountLength must be longer for hole sizes to work. Either decrease mounting hole diameters or increase shelfMountLength"
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "error",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 0,
"end": 0,
"raw": "\"wallMountLength must be longer for hole sizes to work. Either decrease mounting hole diameters or increase shelfMountLength\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "wallMountLength must be longer for hole sizes to work. Either decrease mounting hole diameters or increase shelfMountLength"
}
}
],
"callee": {
@ -936,7 +960,7 @@ description: Result of parsing bracket.kcl
"name": {
"commentStart": 0,
"end": 0,
"name": "assertGreaterThanOrEq",
"name": "assert",
"start": 0,
"type": "Identifier"
},
@ -947,8 +971,24 @@ description: Result of parsing bracket.kcl
"commentStart": 0,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": {
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "shelfMountLength",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
},
"start": 0,
"type": "ExpressionStatement",
@ -960,65 +1000,69 @@ description: Result of parsing bracket.kcl
"expression": {
"arguments": [
{
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "width",
"name": "isGreaterThanOrEqual",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
{
"commentStart": 0,
"end": 0,
"left": {
"abs_path": false,
"arg": {
"commentStart": 0,
"end": 0,
"name": {
"left": {
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": "shelfMountingHoleDiameter",
"name": {
"commentStart": 0,
"end": 0,
"name": "shelfMountingHoleDiameter",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Identifier"
"type": "Name",
"type": "Name"
},
"operator": "*",
"right": {
"commentStart": 0,
"end": 0,
"raw": "5.5",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 5.5,
"suffix": "None"
}
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
"operator": "*",
"right": {
"commentStart": 0,
"end": 0,
"raw": "5.5",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 5.5,
"suffix": "None"
}
},
"start": 0,
"type": "BinaryExpression",
"type": "BinaryExpression"
"type": "BinaryExpression",
"type": "BinaryExpression"
}
},
{
"commentStart": 0,
"end": 0,
"raw": "\"Holes not possible. Either decrease hole diameter or increase width\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "Holes not possible. Either decrease hole diameter or increase width"
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "error",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 0,
"end": 0,
"raw": "\"Holes not possible. Either decrease hole diameter or increase width\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "Holes not possible. Either decrease hole diameter or increase width"
}
}
],
"callee": {
@ -1028,7 +1072,7 @@ description: Result of parsing bracket.kcl
"name": {
"commentStart": 0,
"end": 0,
"name": "assertGreaterThanOrEq",
"name": "assert",
"start": 0,
"type": "Identifier"
},
@ -1039,8 +1083,24 @@ description: Result of parsing bracket.kcl
"commentStart": 0,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": {
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "width",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
},
"start": 0,
"type": "ExpressionStatement",
@ -1052,65 +1112,69 @@ description: Result of parsing bracket.kcl
"expression": {
"arguments": [
{
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "width",
"name": "isGreaterThanOrEqual",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
{
"commentStart": 0,
"end": 0,
"left": {
"abs_path": false,
"arg": {
"commentStart": 0,
"end": 0,
"name": {
"left": {
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": "wallMountingHoleDiameter",
"name": {
"commentStart": 0,
"end": 0,
"name": "wallMountingHoleDiameter",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Identifier"
"type": "Name",
"type": "Name"
},
"operator": "*",
"right": {
"commentStart": 0,
"end": 0,
"raw": "5.5",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 5.5,
"suffix": "None"
}
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
"operator": "*",
"right": {
"commentStart": 0,
"end": 0,
"raw": "5.5",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 5.5,
"suffix": "None"
}
},
"start": 0,
"type": "BinaryExpression",
"type": "BinaryExpression"
"type": "BinaryExpression",
"type": "BinaryExpression"
}
},
{
"commentStart": 0,
"end": 0,
"raw": "\"Holes not possible. Either decrease hole diameter or increase width\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "Holes not possible. Either decrease hole diameter or increase width"
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "error",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 0,
"end": 0,
"raw": "\"Holes not possible. Either decrease hole diameter or increase width\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "Holes not possible. Either decrease hole diameter or increase width"
}
}
],
"callee": {
@ -1120,7 +1184,7 @@ description: Result of parsing bracket.kcl
"name": {
"commentStart": 0,
"end": 0,
"name": "assertGreaterThanOrEq",
"name": "assert",
"start": 0,
"type": "Identifier"
},
@ -1131,8 +1195,24 @@ description: Result of parsing bracket.kcl
"commentStart": 0,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": {
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "width",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
},
"start": 0,
"type": "ExpressionStatement",

File diff suppressed because it is too large Load Diff

View File

@ -1,55 +1,55 @@
```mermaid
flowchart LR
subgraph path2 [Path]
2["Path<br>[850, 935, 0]"]
3["Segment<br>[850, 935, 0]"]
2["Path<br>[863, 948, 0]"]
3["Segment<br>[863, 948, 0]"]
4[Solid2d]
end
subgraph path6 [Path]
6["Path<br>[1172, 1217, 0]"]
7["Segment<br>[1172, 1217, 0]"]
6["Path<br>[1185, 1230, 0]"]
7["Segment<br>[1185, 1230, 0]"]
8[Solid2d]
end
subgraph path15 [Path]
15["Path<br>[1390, 1444, 0]"]
16["Segment<br>[1390, 1444, 0]"]
15["Path<br>[1403, 1457, 0]"]
16["Segment<br>[1403, 1457, 0]"]
17[Solid2d]
end
subgraph path23 [Path]
23["Path<br>[1607, 1664, 0]"]
24["Segment<br>[1607, 1664, 0]"]
23["Path<br>[1620, 1677, 0]"]
24["Segment<br>[1620, 1677, 0]"]
25[Solid2d]
end
subgraph path31 [Path]
31["Path<br>[1799, 1844, 0]"]
32["Segment<br>[1799, 1844, 0]"]
31["Path<br>[1812, 1857, 0]"]
32["Segment<br>[1812, 1857, 0]"]
33[Solid2d]
end
1["Plane<br>[827, 844, 0]"]
5["Plane<br>[1149, 1166, 0]"]
9["Sweep Extrusion<br>[1245, 1276, 0]"]
1["Plane<br>[840, 857, 0]"]
5["Plane<br>[1162, 1179, 0]"]
9["Sweep Extrusion<br>[1258, 1289, 0]"]
10[Wall]
11["Cap Start"]
12["Cap End"]
13["SweepEdge Opposite"]
14["SweepEdge Adjacent"]
18["Sweep Extrusion<br>[1450, 1485, 0]"]
18["Sweep Extrusion<br>[1463, 1498, 0]"]
19[Wall]
20["Cap End"]
21["SweepEdge Opposite"]
22["SweepEdge Adjacent"]
26["Sweep Extrusion<br>[1670, 1703, 0]"]
26["Sweep Extrusion<br>[1683, 1716, 0]"]
27[Wall]
28["Cap End"]
29["SweepEdge Opposite"]
30["SweepEdge Adjacent"]
34["Sweep Extrusion<br>[1850, 1925, 0]"]
34["Sweep Extrusion<br>[1863, 1938, 0]"]
35[Wall]
36["SweepEdge Opposite"]
37["SweepEdge Adjacent"]
38["StartSketchOnFace<br>[1347, 1384, 0]"]
39["StartSketchOnFace<br>[1562, 1601, 0]"]
40["StartSketchOnFace<br>[1754, 1793, 0]"]
38["StartSketchOnFace<br>[1360, 1397, 0]"]
39["StartSketchOnFace<br>[1575, 1614, 0]"]
40["StartSketchOnFace<br>[1767, 1806, 0]"]
1 --- 2
2 --- 3
2 --- 4

View File

@ -429,41 +429,45 @@ description: Result of parsing flange.kcl
"expression": {
"arguments": [
{
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "nHoles",
"name": "isGreaterThan",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
{
"commentStart": 0,
"end": 0,
"raw": "1",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
"arg": {
"commentStart": 0,
"end": 0,
"raw": "1",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
}
}
},
{
"commentStart": 0,
"end": 0,
"raw": "\"nHoles must be greater than 1\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "nHoles must be greater than 1"
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "error",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 0,
"end": 0,
"raw": "\"nHoles must be greater than 1\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "nHoles must be greater than 1"
}
}
],
"callee": {
@ -473,7 +477,7 @@ description: Result of parsing flange.kcl
"name": {
"commentStart": 0,
"end": 0,
"name": "assertGreaterThan",
"name": "assert",
"start": 0,
"type": "Identifier"
},
@ -484,8 +488,24 @@ description: Result of parsing flange.kcl
"commentStart": 0,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": {
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "nHoles",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
},
"preComments": [
"",

View File

@ -1,33 +1,33 @@
```mermaid
flowchart LR
subgraph path2 [Path]
2["Path<br>[993, 1047, 0]"]
3["Segment<br>[1053, 1080, 0]"]
4["Segment<br>[1086, 1114, 0]"]
5["Segment<br>[1120, 1148, 0]"]
6["Segment<br>[1154, 1161, 0]"]
2["Path<br>[1019, 1073, 0]"]
3["Segment<br>[1079, 1106, 0]"]
4["Segment<br>[1112, 1140, 0]"]
5["Segment<br>[1146, 1174, 0]"]
6["Segment<br>[1180, 1187, 0]"]
7[Solid2d]
end
subgraph path23 [Path]
23["Path<br>[1408, 1495, 0]"]
24["Segment<br>[1501, 1538, 0]"]
25["Segment<br>[1544, 1582, 0]"]
26["Segment<br>[1588, 1628, 0]"]
27["Segment<br>[1634, 1641, 0]"]
23["Path<br>[1434, 1521, 0]"]
24["Segment<br>[1527, 1564, 0]"]
25["Segment<br>[1570, 1608, 0]"]
26["Segment<br>[1614, 1654, 0]"]
27["Segment<br>[1660, 1667, 0]"]
28[Solid2d]
end
subgraph path43 [Path]
43["Path<br>[1765, 1912, 0]"]
44["Segment<br>[1765, 1912, 0]"]
43["Path<br>[1791, 1938, 0]"]
44["Segment<br>[1791, 1938, 0]"]
45[Solid2d]
end
subgraph path56 [Path]
56["Path<br>[2202, 2377, 0]"]
57["Segment<br>[2202, 2377, 0]"]
56["Path<br>[2228, 2403, 0]"]
57["Segment<br>[2228, 2403, 0]"]
58[Solid2d]
end
1["Plane<br>[970, 987, 0]"]
8["Sweep Extrusion<br>[1167, 1191, 0]"]
1["Plane<br>[996, 1013, 0]"]
8["Sweep Extrusion<br>[1193, 1217, 0]"]
9[Wall]
10[Wall]
11[Wall]
@ -42,7 +42,7 @@ flowchart LR
20["SweepEdge Adjacent"]
21["SweepEdge Opposite"]
22["SweepEdge Adjacent"]
29["Sweep Extrusion<br>[1647, 1678, 0]"]
29["Sweep Extrusion<br>[1673, 1704, 0]"]
30[Wall]
31[Wall]
32[Wall]
@ -56,25 +56,25 @@ flowchart LR
40["SweepEdge Adjacent"]
41["SweepEdge Opposite"]
42["SweepEdge Adjacent"]
46["Sweep Extrusion<br>[2066, 2094, 0]"]
46["Sweep Extrusion<br>[2092, 2120, 0]"]
47[Wall]
48["Cap End"]
49["SweepEdge Opposite"]
50["SweepEdge Adjacent"]
51["Sweep Extrusion<br>[2066, 2094, 0]"]
52["Sweep Extrusion<br>[2066, 2094, 0]"]
53["Sweep Extrusion<br>[2066, 2094, 0]"]
54["Sweep Extrusion<br>[2066, 2094, 0]"]
55["Sweep Extrusion<br>[2066, 2094, 0]"]
59["Sweep Extrusion<br>[2539, 2567, 0]"]
51["Sweep Extrusion<br>[2092, 2120, 0]"]
52["Sweep Extrusion<br>[2092, 2120, 0]"]
53["Sweep Extrusion<br>[2092, 2120, 0]"]
54["Sweep Extrusion<br>[2092, 2120, 0]"]
55["Sweep Extrusion<br>[2092, 2120, 0]"]
59["Sweep Extrusion<br>[2565, 2593, 0]"]
60[Wall]
61["Cap End"]
62["SweepEdge Opposite"]
63["SweepEdge Adjacent"]
64["Sweep Extrusion<br>[2539, 2567, 0]"]
65["StartSketchOnFace<br>[1369, 1402, 0]"]
66["StartSketchOnFace<br>[1728, 1759, 0]"]
67["StartSketchOnFace<br>[2155, 2196, 0]"]
64["Sweep Extrusion<br>[2565, 2593, 0]"]
65["StartSketchOnFace<br>[1395, 1428, 0]"]
66["StartSketchOnFace<br>[1754, 1785, 0]"]
67["StartSketchOnFace<br>[2181, 2222, 0]"]
1 --- 2
2 --- 3
2 --- 4

View File

@ -768,41 +768,45 @@ description: Result of parsing lego.kcl
"expression": {
"arguments": [
{
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "lbumps",
"name": "isGreaterThan",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
{
"commentStart": 0,
"end": 0,
"raw": "1",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
"arg": {
"commentStart": 0,
"end": 0,
"raw": "1",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
}
}
},
{
"commentStart": 0,
"end": 0,
"raw": "\"lbumps must be greater than 1\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "lbumps must be greater than 1"
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "error",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 0,
"end": 0,
"raw": "\"lbumps must be greater than 1\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "lbumps must be greater than 1"
}
}
],
"callee": {
@ -812,7 +816,7 @@ description: Result of parsing lego.kcl
"name": {
"commentStart": 0,
"end": 0,
"name": "assertGreaterThan",
"name": "assert",
"start": 0,
"type": "Identifier"
},
@ -823,8 +827,24 @@ description: Result of parsing lego.kcl
"commentStart": 0,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": {
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "lbumps",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
},
"preComments": [
"",
@ -841,41 +861,45 @@ description: Result of parsing lego.kcl
"expression": {
"arguments": [
{
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "wbumps",
"name": "isGreaterThan",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
{
"commentStart": 0,
"end": 0,
"raw": "1",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
"arg": {
"commentStart": 0,
"end": 0,
"raw": "1",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
}
}
},
{
"commentStart": 0,
"end": 0,
"raw": "\"wbumps must be greater than 1\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "wbumps must be greater than 1"
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "error",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 0,
"end": 0,
"raw": "\"wbumps must be greater than 1\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "wbumps must be greater than 1"
}
}
],
"callee": {
@ -885,7 +909,7 @@ description: Result of parsing lego.kcl
"name": {
"commentStart": 0,
"end": 0,
"name": "assertGreaterThan",
"name": "assert",
"start": 0,
"type": "Identifier"
},
@ -896,8 +920,24 @@ description: Result of parsing lego.kcl
"commentStart": 0,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": {
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "wbumps",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
},
"start": 0,
"type": "ExpressionStatement",

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

View File

@ -137,41 +137,45 @@ description: Result of parsing property_of_object.kcl
"expression": {
"arguments": [
{
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "one_a",
"name": "isLessThanOrEqual",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
{
"commentStart": 0,
"end": 0,
"raw": "1",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
"arg": {
"commentStart": 0,
"end": 0,
"raw": "1",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
}
}
},
{
"commentStart": 0,
"end": 0,
"raw": "\"Literal property lookup\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "Literal property lookup"
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "error",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 0,
"end": 0,
"raw": "\"Literal property lookup\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "Literal property lookup"
}
}
],
"callee": {
@ -181,7 +185,7 @@ description: Result of parsing property_of_object.kcl
"name": {
"commentStart": 0,
"end": 0,
"name": "assertLessThanOrEq",
"name": "assert",
"start": 0,
"type": "Identifier"
},
@ -192,8 +196,24 @@ description: Result of parsing property_of_object.kcl
"commentStart": 0,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": {
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "one_a",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
},
"start": 0,
"type": "ExpressionStatement",
@ -205,41 +225,45 @@ description: Result of parsing property_of_object.kcl
"expression": {
"arguments": [
{
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "one_a",
"name": "isGreaterThanOrEqual",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
{
"commentStart": 0,
"end": 0,
"raw": "1",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
"arg": {
"commentStart": 0,
"end": 0,
"raw": "1",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
}
}
},
{
"commentStart": 0,
"end": 0,
"raw": "\"Literal property lookup\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "Literal property lookup"
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "error",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 0,
"end": 0,
"raw": "\"Literal property lookup\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "Literal property lookup"
}
}
],
"callee": {
@ -249,7 +273,7 @@ description: Result of parsing property_of_object.kcl
"name": {
"commentStart": 0,
"end": 0,
"name": "assertGreaterThanOrEq",
"name": "assert",
"start": 0,
"type": "Identifier"
},
@ -260,8 +284,24 @@ description: Result of parsing property_of_object.kcl
"commentStart": 0,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": {
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "one_a",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
},
"start": 0,
"type": "ExpressionStatement",
@ -348,41 +388,45 @@ description: Result of parsing property_of_object.kcl
"expression": {
"arguments": [
{
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "one_b",
"name": "isLessThanOrEqual",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
{
"commentStart": 0,
"end": 0,
"raw": "1",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
"arg": {
"commentStart": 0,
"end": 0,
"raw": "1",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
}
}
},
{
"commentStart": 0,
"end": 0,
"raw": "\"Computed property lookup\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "Computed property lookup"
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "error",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 0,
"end": 0,
"raw": "\"Computed property lookup\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "Computed property lookup"
}
}
],
"callee": {
@ -392,7 +436,7 @@ description: Result of parsing property_of_object.kcl
"name": {
"commentStart": 0,
"end": 0,
"name": "assertLessThanOrEq",
"name": "assert",
"start": 0,
"type": "Identifier"
},
@ -403,8 +447,24 @@ description: Result of parsing property_of_object.kcl
"commentStart": 0,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": {
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "one_b",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
},
"start": 0,
"type": "ExpressionStatement",
@ -416,41 +476,45 @@ description: Result of parsing property_of_object.kcl
"expression": {
"arguments": [
{
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "one_b",
"name": "isGreaterThanOrEqual",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
{
"commentStart": 0,
"end": 0,
"raw": "1",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
"arg": {
"commentStart": 0,
"end": 0,
"raw": "1",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
}
}
},
{
"commentStart": 0,
"end": 0,
"raw": "\"Computed property lookup\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "Computed property lookup"
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "error",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 0,
"end": 0,
"raw": "\"Computed property lookup\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "Computed property lookup"
}
}
],
"callee": {
@ -460,7 +524,7 @@ description: Result of parsing property_of_object.kcl
"name": {
"commentStart": 0,
"end": 0,
"name": "assertGreaterThanOrEq",
"name": "assert",
"start": 0,
"type": "Identifier"
},
@ -471,8 +535,24 @@ description: Result of parsing property_of_object.kcl
"commentStart": 0,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": {
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "one_b",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
},
"start": 0,
"type": "ExpressionStatement",
@ -605,41 +685,45 @@ description: Result of parsing property_of_object.kcl
"expression": {
"arguments": [
{
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "one_c",
"name": "isLessThanOrEqual",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
{
"commentStart": 0,
"end": 0,
"raw": "1",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
"arg": {
"commentStart": 0,
"end": 0,
"raw": "1",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
}
}
},
{
"commentStart": 0,
"end": 0,
"raw": "\"Literal property lookup\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "Literal property lookup"
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "error",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 0,
"end": 0,
"raw": "\"Literal property lookup\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "Literal property lookup"
}
}
],
"callee": {
@ -649,7 +733,7 @@ description: Result of parsing property_of_object.kcl
"name": {
"commentStart": 0,
"end": 0,
"name": "assertLessThanOrEq",
"name": "assert",
"start": 0,
"type": "Identifier"
},
@ -660,8 +744,24 @@ description: Result of parsing property_of_object.kcl
"commentStart": 0,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": {
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "one_c",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
},
"start": 0,
"type": "ExpressionStatement",
@ -673,41 +773,45 @@ description: Result of parsing property_of_object.kcl
"expression": {
"arguments": [
{
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "one_c",
"name": "isGreaterThanOrEqual",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
{
"commentStart": 0,
"end": 0,
"raw": "1",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
"arg": {
"commentStart": 0,
"end": 0,
"raw": "1",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
}
}
},
{
"commentStart": 0,
"end": 0,
"raw": "\"Literal property lookup\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "Literal property lookup"
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "error",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 0,
"end": 0,
"raw": "\"Literal property lookup\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "Literal property lookup"
}
}
],
"callee": {
@ -717,7 +821,7 @@ description: Result of parsing property_of_object.kcl
"name": {
"commentStart": 0,
"end": 0,
"name": "assertGreaterThanOrEq",
"name": "assert",
"start": 0,
"type": "Identifier"
},
@ -728,8 +832,24 @@ description: Result of parsing property_of_object.kcl
"commentStart": 0,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": {
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "one_c",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
},
"start": 0,
"type": "ExpressionStatement",
@ -802,41 +922,45 @@ description: Result of parsing property_of_object.kcl
"expression": {
"arguments": [
{
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "one_d",
"name": "isLessThanOrEqual",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
{
"commentStart": 0,
"end": 0,
"raw": "1",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
"arg": {
"commentStart": 0,
"end": 0,
"raw": "1",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
}
}
},
{
"commentStart": 0,
"end": 0,
"raw": "\"Computed property lookup\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "Computed property lookup"
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "error",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 0,
"end": 0,
"raw": "\"Computed property lookup\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "Computed property lookup"
}
}
],
"callee": {
@ -846,7 +970,7 @@ description: Result of parsing property_of_object.kcl
"name": {
"commentStart": 0,
"end": 0,
"name": "assertLessThanOrEq",
"name": "assert",
"start": 0,
"type": "Identifier"
},
@ -857,8 +981,24 @@ description: Result of parsing property_of_object.kcl
"commentStart": 0,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": {
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "one_d",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
},
"start": 0,
"type": "ExpressionStatement",
@ -870,41 +1010,45 @@ description: Result of parsing property_of_object.kcl
"expression": {
"arguments": [
{
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "one_d",
"name": "isGreaterThanOrEqual",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
{
"commentStart": 0,
"end": 0,
"raw": "1",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
"arg": {
"commentStart": 0,
"end": 0,
"raw": "1",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
}
}
},
{
"commentStart": 0,
"end": 0,
"raw": "\"Computed property lookup\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "Computed property lookup"
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "error",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 0,
"end": 0,
"raw": "\"Computed property lookup\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "Computed property lookup"
}
}
],
"callee": {
@ -914,7 +1058,7 @@ description: Result of parsing property_of_object.kcl
"name": {
"commentStart": 0,
"end": 0,
"name": "assertGreaterThanOrEq",
"name": "assert",
"start": 0,
"type": "Identifier"
},
@ -925,8 +1069,24 @@ description: Result of parsing property_of_object.kcl
"commentStart": 0,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": {
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "one_d",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
},
"start": 0,
"type": "ExpressionStatement",

View File

@ -8,8 +8,8 @@ obj = { foo = 1, bar = 0 }
one_a = obj["foo"]
assertLessThanOrEq(one_a, 1, "Literal property lookup")
assertGreaterThanOrEq(one_a, 1, "Literal property lookup")
assert(one_a, isLessThanOrEqual = 1, error = "Literal property lookup")
assert(one_a, isGreaterThanOrEqual = 1, error = "Literal property lookup")
// Test: the property is a variable,
// which must be evaluated before looking it up.
@ -18,8 +18,8 @@ assertGreaterThanOrEq(one_a, 1, "Literal property lookup")
p = "foo"
one_b = obj[p]
assertLessThanOrEq(one_b, 1, "Computed property lookup")
assertGreaterThanOrEq(one_b, 1, "Computed property lookup")
assert(one_b, isLessThanOrEqual = 1, error = "Computed property lookup")
assert(one_b, isGreaterThanOrEqual = 1, error = "Computed property lookup")
// Test: multiple literal properties.
@ -28,13 +28,13 @@ obj2 = { inner = obj }
one_c = obj2.inner["foo"]
assertLessThanOrEq(one_c, 1, "Literal property lookup")
assertGreaterThanOrEq(one_c, 1, "Literal property lookup")
assert(one_c, isLessThanOrEqual = 1, error = "Literal property lookup")
assert(one_c, isGreaterThanOrEqual = 1, error = "Literal property lookup")
// Test: multiple properties, mix of literal and computed.
one_d = obj2.inner[p]
assertLessThanOrEq(one_d, 1, "Computed property lookup")
assertGreaterThanOrEq(one_d, 1, "Computed property lookup")
assert(one_d, isLessThanOrEqual = 1, error = "Computed property lookup")
assert(one_d, isGreaterThanOrEqual = 1, error = "Computed property lookup")

View File

@ -12,8 +12,8 @@ obj = { foo = 1, bar = 0 }
one_a = obj["foo"]
assertLessThanOrEq(one_a, 1, "Literal property lookup")
assertGreaterThanOrEq(one_a, 1, "Literal property lookup")
assert(one_a, isLessThanOrEqual = 1, error = "Literal property lookup")
assert(one_a, isGreaterThanOrEqual = 1, error = "Literal property lookup")
// Test: the property is a variable,
// which must be evaluated before looking it up.
@ -22,8 +22,8 @@ assertGreaterThanOrEq(one_a, 1, "Literal property lookup")
p = "foo"
one_b = obj[p]
assertLessThanOrEq(one_b, 1, "Computed property lookup")
assertGreaterThanOrEq(one_b, 1, "Computed property lookup")
assert(one_b, isLessThanOrEqual = 1, error = "Computed property lookup")
assert(one_b, isGreaterThanOrEqual = 1, error = "Computed property lookup")
// Test: multiple literal properties.
@ -32,13 +32,13 @@ obj2 = { inner = obj }
one_c = obj2.inner["foo"]
assertLessThanOrEq(one_c, 1, "Literal property lookup")
assertGreaterThanOrEq(one_c, 1, "Literal property lookup")
assert(one_c, isLessThanOrEqual = 1, error = "Literal property lookup")
assert(one_c, isGreaterThanOrEqual = 1, error = "Literal property lookup")
// Test: multiple properties, mix of literal and computed.
one_d = obj2.inner[p]
assertLessThanOrEq(one_d, 1, "Computed property lookup")
assertGreaterThanOrEq(one_d, 1, "Computed property lookup")
assert(one_d, isLessThanOrEqual = 1, error = "Computed property lookup")
assert(one_d, isGreaterThanOrEqual = 1, error = "Computed property lookup")