Support comments on attributes (#5850)

Signed-off-by: Nick Cameron <nrc@ncameron.org>
This commit is contained in:
Nick Cameron
2025-03-20 16:23:20 +13:00
committed by GitHub
parent 79be72c5f0
commit 461a2c3ab2
319 changed files with 37650 additions and 4752 deletions

View File

@ -6,17 +6,22 @@ description: Result of parsing computed_var.kcl
"Ok": {
"body": [
{
"commentStart": 0,
"declaration": {
"commentStart": 37,
"end": 0,
"id": {
"commentStart": 37,
"end": 0,
"name": "arr",
"start": 0,
"type": "Identifier"
},
"init": {
"commentStart": 43,
"elements": [
{
"commentStart": 44,
"end": 0,
"raw": "0",
"start": 0,
@ -28,6 +33,7 @@ description: Result of parsing computed_var.kcl
}
},
{
"commentStart": 47,
"end": 0,
"raw": "0",
"start": 0,
@ -39,6 +45,7 @@ description: Result of parsing computed_var.kcl
}
},
{
"commentStart": 50,
"end": 0,
"raw": "0",
"start": 0,
@ -50,6 +57,7 @@ description: Result of parsing computed_var.kcl
}
},
{
"commentStart": 53,
"end": 0,
"raw": "10",
"start": 0,
@ -76,15 +84,19 @@ description: Result of parsing computed_var.kcl
"type": "VariableDeclaration"
},
{
"commentStart": 57,
"declaration": {
"commentStart": 57,
"end": 0,
"id": {
"commentStart": 57,
"end": 0,
"name": "i",
"start": 0,
"type": "Identifier"
},
"init": {
"commentStart": 61,
"end": 0,
"raw": "3",
"start": 0,
@ -105,18 +117,23 @@ description: Result of parsing computed_var.kcl
"type": "VariableDeclaration"
},
{
"commentStart": 63,
"declaration": {
"commentStart": 63,
"end": 0,
"id": {
"commentStart": 63,
"end": 0,
"name": "ten",
"start": 0,
"type": "Identifier"
},
"init": {
"commentStart": 69,
"computed": true,
"end": 0,
"object": {
"commentStart": 69,
"end": 0,
"name": "arr",
"start": 0,
@ -124,6 +141,7 @@ description: Result of parsing computed_var.kcl
"type": "Identifier"
},
"property": {
"commentStart": 73,
"end": 0,
"name": "i",
"start": 0,
@ -144,10 +162,12 @@ description: Result of parsing computed_var.kcl
"type": "VariableDeclaration"
},
{
"commentStart": 75,
"end": 0,
"expression": {
"arguments": [
{
"commentStart": 89,
"end": 0,
"name": "ten",
"start": 0,
@ -155,6 +175,7 @@ description: Result of parsing computed_var.kcl
"type": "Identifier"
},
{
"commentStart": 94,
"end": 0,
"raw": "10",
"start": 0,
@ -166,6 +187,7 @@ description: Result of parsing computed_var.kcl
}
},
{
"commentStart": 98,
"end": 0,
"raw": "0.000001",
"start": 0,
@ -177,6 +199,7 @@ description: Result of parsing computed_var.kcl
}
},
{
"commentStart": 108,
"end": 0,
"raw": "\"oops\"",
"start": 0,
@ -186,11 +209,13 @@ description: Result of parsing computed_var.kcl
}
],
"callee": {
"commentStart": 77,
"end": 0,
"name": "assertEqual",
"start": 0,
"type": "Identifier"
},
"commentStart": 77,
"end": 0,
"start": 0,
"type": "CallExpression",
@ -201,15 +226,19 @@ description: Result of parsing computed_var.kcl
"type": "ExpressionStatement"
},
{
"commentStart": 115,
"declaration": {
"commentStart": 117,
"end": 0,
"id": {
"commentStart": 117,
"end": 0,
"name": "p",
"start": 0,
"type": "Identifier"
},
"init": {
"commentStart": 121,
"end": 0,
"raw": "\"foo\"",
"start": 0,
@ -227,20 +256,26 @@ description: Result of parsing computed_var.kcl
"type": "VariableDeclaration"
},
{
"commentStart": 127,
"declaration": {
"commentStart": 127,
"end": 0,
"id": {
"commentStart": 127,
"end": 0,
"name": "obj",
"start": 0,
"type": "Identifier"
},
"init": {
"commentStart": 133,
"end": 0,
"properties": [
{
"commentStart": 135,
"end": 0,
"key": {
"commentStart": 135,
"end": 0,
"name": "foo",
"start": 0,
@ -249,6 +284,7 @@ description: Result of parsing computed_var.kcl
"start": 0,
"type": "ObjectProperty",
"value": {
"commentStart": 141,
"end": 0,
"raw": "1",
"start": 0,
@ -261,8 +297,10 @@ description: Result of parsing computed_var.kcl
}
},
{
"commentStart": 144,
"end": 0,
"key": {
"commentStart": 144,
"end": 0,
"name": "bar",
"start": 0,
@ -271,6 +309,7 @@ description: Result of parsing computed_var.kcl
"start": 0,
"type": "ObjectProperty",
"value": {
"commentStart": 150,
"end": 0,
"raw": "0",
"start": 0,
@ -297,18 +336,23 @@ description: Result of parsing computed_var.kcl
"type": "VariableDeclaration"
},
{
"commentStart": 154,
"declaration": {
"commentStart": 154,
"end": 0,
"id": {
"commentStart": 154,
"end": 0,
"name": "one",
"start": 0,
"type": "Identifier"
},
"init": {
"commentStart": 160,
"computed": true,
"end": 0,
"object": {
"commentStart": 160,
"end": 0,
"name": "obj",
"start": 0,
@ -316,6 +360,7 @@ description: Result of parsing computed_var.kcl
"type": "Identifier"
},
"property": {
"commentStart": 164,
"end": 0,
"name": "p",
"start": 0,
@ -336,10 +381,12 @@ description: Result of parsing computed_var.kcl
"type": "VariableDeclaration"
},
{
"commentStart": 166,
"end": 0,
"expression": {
"arguments": [
{
"commentStart": 180,
"end": 0,
"name": "one",
"start": 0,
@ -347,6 +394,7 @@ description: Result of parsing computed_var.kcl
"type": "Identifier"
},
{
"commentStart": 185,
"end": 0,
"raw": "1",
"start": 0,
@ -358,6 +406,7 @@ description: Result of parsing computed_var.kcl
}
},
{
"commentStart": 188,
"end": 0,
"raw": "0.0000001",
"start": 0,
@ -369,6 +418,7 @@ description: Result of parsing computed_var.kcl
}
},
{
"commentStart": 199,
"end": 0,
"raw": "\"oops\"",
"start": 0,
@ -378,11 +428,13 @@ description: Result of parsing computed_var.kcl
}
],
"callee": {
"commentStart": 168,
"end": 0,
"name": "assertEqual",
"start": 0,
"type": "Identifier"
},
"commentStart": 168,
"end": 0,
"start": 0,
"type": "CallExpression",
@ -393,10 +445,12 @@ description: Result of parsing computed_var.kcl
"type": "ExpressionStatement"
},
{
"commentStart": 206,
"end": 0,
"expression": {
"arguments": [
{
"commentStart": 220,
"end": 0,
"name": "PI",
"start": 0,
@ -404,6 +458,7 @@ description: Result of parsing computed_var.kcl
"type": "Identifier"
},
{
"commentStart": 224,
"end": 0,
"raw": "3",
"start": 0,
@ -415,6 +470,7 @@ description: Result of parsing computed_var.kcl
}
},
{
"commentStart": 227,
"end": 0,
"raw": "0.2",
"start": 0,
@ -426,6 +482,7 @@ description: Result of parsing computed_var.kcl
}
},
{
"commentStart": 232,
"end": 0,
"raw": "\"oops pi\"",
"start": 0,
@ -435,11 +492,13 @@ description: Result of parsing computed_var.kcl
}
],
"callee": {
"commentStart": 208,
"end": 0,
"name": "assertEqual",
"start": 0,
"type": "Identifier"
},
"commentStart": 208,
"end": 0,
"start": 0,
"type": "CallExpression",
@ -450,9 +509,12 @@ description: Result of parsing computed_var.kcl
"type": "ExpressionStatement"
},
{
"commentStart": 243,
"declaration": {
"commentStart": 243,
"end": 0,
"id": {
"commentStart": 243,
"end": 0,
"name": "x",
"start": 0,
@ -461,8 +523,10 @@ description: Result of parsing computed_var.kcl
"init": {
"arguments": [
{
"commentStart": 251,
"end": 0,
"left": {
"commentStart": 251,
"end": 0,
"raw": "2",
"start": 0,
@ -475,6 +539,7 @@ description: Result of parsing computed_var.kcl
},
"operator": "*",
"right": {
"commentStart": 255,
"end": 0,
"name": "PI",
"start": 0,
@ -487,11 +552,13 @@ description: Result of parsing computed_var.kcl
}
],
"callee": {
"commentStart": 247,
"end": 0,
"name": "cos",
"start": 0,
"type": "Identifier"
},
"commentStart": 247,
"end": 0,
"start": 0,
"type": "CallExpression",
@ -507,10 +574,12 @@ description: Result of parsing computed_var.kcl
"type": "VariableDeclaration"
},
{
"commentStart": 259,
"end": 0,
"expression": {
"arguments": [
{
"commentStart": 271,
"end": 0,
"name": "x",
"start": 0,
@ -518,6 +587,7 @@ description: Result of parsing computed_var.kcl
"type": "Identifier"
},
{
"commentStart": 274,
"end": 0,
"raw": "1",
"start": 0,
@ -529,6 +599,7 @@ description: Result of parsing computed_var.kcl
}
},
{
"commentStart": 277,
"end": 0,
"raw": "0.000001",
"start": 0,
@ -540,6 +611,7 @@ description: Result of parsing computed_var.kcl
}
},
{
"commentStart": 287,
"end": 0,
"raw": "\"oops cos\"",
"start": 0,
@ -549,11 +621,13 @@ description: Result of parsing computed_var.kcl
}
],
"callee": {
"commentStart": 259,
"end": 0,
"name": "assertEqual",
"start": 0,
"type": "Identifier"
},
"commentStart": 259,
"end": 0,
"start": 0,
"type": "CallExpression",
@ -564,11 +638,13 @@ description: Result of parsing computed_var.kcl
"type": "ExpressionStatement"
}
],
"commentStart": 0,
"end": 0,
"nonCodeMeta": {
"nonCodeNodes": {
"2": [
{
"commentStart": 75,
"end": 0,
"start": 0,
"type": "NonCodeNode",
@ -579,6 +655,7 @@ description: Result of parsing computed_var.kcl
],
"3": [
{
"commentStart": 115,
"end": 0,
"start": 0,
"type": "NonCodeNode",
@ -589,6 +666,7 @@ description: Result of parsing computed_var.kcl
],
"6": [
{
"commentStart": 166,
"end": 0,
"start": 0,
"type": "NonCodeNode",
@ -599,6 +677,7 @@ description: Result of parsing computed_var.kcl
],
"7": [
{
"commentStart": 206,
"end": 0,
"start": 0,
"type": "NonCodeNode",
@ -610,6 +689,7 @@ description: Result of parsing computed_var.kcl
},
"startNodes": [
{
"commentStart": 0,
"end": 0,
"start": 0,
"type": "NonCodeNode",
@ -620,6 +700,7 @@ description: Result of parsing computed_var.kcl
}
},
{
"commentStart": 34,
"end": 0,
"start": 0,
"type": "NonCodeNode",