Skip to content

Commit c063f15

Browse files
committed
Update size to length for lists
1 parent 2b78885 commit c063f15

File tree

5 files changed

+47
-47
lines changed

5 files changed

+47
-47
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ function main() {
5656
io.log("Average temperature: ", temperature.avg);
5757

5858
let numbers = Numbers { 1, 2, 3, 4, 5 }, i = 0;
59-
for(i; i < numbers.size; i = i + 1) {
59+
for(i; i < numbers.length; i = i + 1) {
6060
io.log("Number at index ", i, " is ", numbers.i);
6161
}
6262
}

examples/list.gom

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ function main() {
1212
let numbers = Numbers { 1, 2, 3, 4, 5 };
1313

1414
let i = 0;
15-
for(i; i < numbers.size; i = i + 1) {
15+
for(i; i < numbers.length; i = i + 1) {
1616
io.log("numbers[", i, "] = ", numbers.i);
1717
}
1818

@@ -22,7 +22,7 @@ function main() {
2222
Status { code: 500, success: false },
2323
};
2424
let j = 0;
25-
for(j; j < statusList.size; j = j + 1) {
25+
for(j; j < statusList.length; j = j + 1) {
2626
let status = statusList.j;
2727
io.log("statusList[", j, "] = { code: ", status.code, ", success: ", status.success, " }");
2828
}
@@ -35,7 +35,7 @@ function main() {
3535
{ 9, 10 },
3636
};
3737
let k = 0;
38-
for(k; k < pairs.size; k = k + 1) {
38+
for(k; k < pairs.length; k = k + 1) {
3939
let pair = pairs.k;
4040
io.log("pairs[", k, "] = { ", pair.0, ", ", pair.1, " }");
4141
}

examples/readme.gom

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ function main() {
2121
io.log("Average temperature: ", temperature.avg);
2222

2323
let numbers = Numbers { 1, 2, 3, 4, 5 }, i = 0;
24-
for(i; i < numbers.size; i = i + 1) {
24+
for(i; i < numbers.length; i = i + 1) {
2525
io.log("Number at index ", i, " is ", numbers.i);
2626
}
2727
}

src/semantics/type.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ export class GomListType extends GomType {
7070
name: string;
7171
kind: GomTypeKind;
7272
elementType: GomType;
73-
static readonly SIZE_PROPERTY = "size";
73+
static readonly SIZE_PROPERTY = "length";
7474

7575
constructor(name: string, elementType: GomType) {
7676
super();

tree.json

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1015,13 +1015,13 @@
10151015
"loc": 359,
10161016
"token": {
10171017
"type": "identifier",
1018-
"value": "size",
1018+
"value": "length",
10191019
"start": 359,
1020-
"end": 362
1020+
"end": 364
10211021
},
10221022
"gomType": {
10231023
"kind": "PrimitiveOrAlias",
1024-
"typeString": "resolve_type@@size"
1024+
"typeString": "resolve_type@@length"
10251025
},
10261026
"resultantType": {
10271027
"kind": "PrimitiveOrAlias",
@@ -1041,16 +1041,16 @@
10411041
"updateExpr": {
10421042
"_id": 72,
10431043
"type": "ASSIGNMENT",
1044-
"loc": 365,
1044+
"loc": 367,
10451045
"lhs": {
10461046
"_id": 68,
10471047
"type": "TERM",
1048-
"loc": 365,
1048+
"loc": 367,
10491049
"token": {
10501050
"type": "identifier",
10511051
"value": "i",
1052-
"start": 365,
1053-
"end": 365
1052+
"start": 367,
1053+
"end": 367
10541054
},
10551055
"gomType": {
10561056
"kind": "PrimitiveOrAlias",
@@ -1064,16 +1064,16 @@
10641064
"rhs": {
10651065
"_id": 71,
10661066
"type": "SUM",
1067-
"loc": 369,
1067+
"loc": 371,
10681068
"lhs": {
10691069
"_id": 69,
10701070
"type": "TERM",
1071-
"loc": 369,
1071+
"loc": 371,
10721072
"token": {
10731073
"type": "identifier",
10741074
"value": "i",
1075-
"start": 369,
1076-
"end": 369
1075+
"start": 371,
1076+
"end": 371
10771077
},
10781078
"gomType": {
10791079
"kind": "PrimitiveOrAlias",
@@ -1087,18 +1087,18 @@
10871087
"op": {
10881088
"type": "+",
10891089
"value": "+",
1090-
"start": 371,
1091-
"end": 371
1090+
"start": 373,
1091+
"end": 373
10921092
},
10931093
"rhs": {
10941094
"_id": 70,
10951095
"type": "TERM",
1096-
"loc": 373,
1096+
"loc": 375,
10971097
"token": {
10981098
"type": "numliteral",
10991099
"value": "1",
1100-
"start": 373,
1101-
"end": 373
1100+
"start": 375,
1101+
"end": 375
11021102
},
11031103
"gomType": {
11041104
"kind": "PrimitiveOrAlias",
@@ -1123,20 +1123,20 @@
11231123
{
11241124
"_id": 83,
11251125
"type": "EXPRESSION_STATEMENT",
1126-
"loc": 380,
1126+
"loc": 382,
11271127
"expr": {
11281128
"_id": 82,
11291129
"type": "ACCESS",
1130-
"loc": 380,
1130+
"loc": 382,
11311131
"lhs": {
11321132
"_id": 73,
11331133
"type": "TERM",
1134-
"loc": 380,
1134+
"loc": 382,
11351135
"token": {
11361136
"type": "identifier",
11371137
"value": "io",
1138-
"start": 380,
1139-
"end": 381
1138+
"start": 382,
1139+
"end": 383
11401140
},
11411141
"gomType": {
11421142
"kind": "PrimitiveOrAlias",
@@ -1150,16 +1150,16 @@
11501150
"rhs": {
11511151
"_id": 81,
11521152
"type": "CALL",
1153-
"loc": 383,
1153+
"loc": 385,
11541154
"id": {
11551155
"_id": 74,
11561156
"type": "TERM",
1157-
"loc": 383,
1157+
"loc": 385,
11581158
"token": {
11591159
"type": "identifier",
11601160
"value": "log",
1161-
"start": 383,
1162-
"end": 385
1161+
"start": 385,
1162+
"end": 387
11631163
},
11641164
"gomType": {
11651165
"kind": "PrimitiveOrAlias",
@@ -1174,12 +1174,12 @@
11741174
{
11751175
"_id": 75,
11761176
"type": "TERM",
1177-
"loc": 387,
1177+
"loc": 389,
11781178
"token": {
11791179
"type": "strliteral",
11801180
"value": "\"Number at index \"",
1181-
"start": 387,
1182-
"end": 404
1181+
"start": 389,
1182+
"end": 406
11831183
},
11841184
"gomType": {
11851185
"kind": "PrimitiveOrAlias",
@@ -1193,12 +1193,12 @@
11931193
{
11941194
"_id": 76,
11951195
"type": "TERM",
1196-
"loc": 407,
1196+
"loc": 409,
11971197
"token": {
11981198
"type": "identifier",
11991199
"value": "i",
1200-
"start": 407,
1201-
"end": 407
1200+
"start": 409,
1201+
"end": 409
12021202
},
12031203
"gomType": {
12041204
"kind": "PrimitiveOrAlias",
@@ -1212,12 +1212,12 @@
12121212
{
12131213
"_id": 77,
12141214
"type": "TERM",
1215-
"loc": 410,
1215+
"loc": 412,
12161216
"token": {
12171217
"type": "strliteral",
12181218
"value": "\" is \"",
1219-
"start": 410,
1220-
"end": 415
1219+
"start": 412,
1220+
"end": 417
12211221
},
12221222
"gomType": {
12231223
"kind": "PrimitiveOrAlias",
@@ -1231,16 +1231,16 @@
12311231
{
12321232
"_id": 80,
12331233
"type": "ACCESS",
1234-
"loc": 418,
1234+
"loc": 420,
12351235
"lhs": {
12361236
"_id": 78,
12371237
"type": "TERM",
1238-
"loc": 418,
1238+
"loc": 420,
12391239
"token": {
12401240
"type": "identifier",
12411241
"value": "numbers",
1242-
"start": 418,
1243-
"end": 424
1242+
"start": 420,
1243+
"end": 426
12441244
},
12451245
"gomType": {
12461246
"kind": "PrimitiveOrAlias",
@@ -1258,12 +1258,12 @@
12581258
"rhs": {
12591259
"_id": 79,
12601260
"type": "TERM",
1261-
"loc": 426,
1261+
"loc": 428,
12621262
"token": {
12631263
"type": "identifier",
12641264
"value": "i",
1265-
"start": 426,
1266-
"end": 426
1265+
"start": 428,
1266+
"end": 428
12671267
},
12681268
"gomType": {
12691269
"kind": "PrimitiveOrAlias",

0 commit comments

Comments
 (0)