Skip to content

Commit ba8fb83

Browse files
committed
COMMON: #121 Fix array access regression
1 parent 75c4c0a commit ba8fb83

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

ChangeLog

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
2021-05-03 (12.22)
2+
COMMON: Fix array access regression
3+
14
2021-05-03 (12.22)
25
ANDROID: Removes path navigation to show unified view of available folder
36

samples/distro-examples/tests/array.bas

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,3 +327,12 @@ sub xfunc(argx)
327327
end
328328
z=anims[0].framePoses[0, 0].translation
329329
xfunc(anims[0].framePoses[0, 0].translation)
330+
331+
dim a()
332+
append a, [1,2],[3,4],[5,6]
333+
a << [7,8,9]
334+
if (a[0] != [1,2]) then throw "err1"
335+
if (a[1] != [3,4]) then throw "err2"
336+
if (a[2] != [5,6]) then throw "err3"
337+
if (a[3] != [7,8,9]) then throw "err4"
338+

src/common/scan.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1339,7 +1339,7 @@ void comp_expression(char *expr, byte no_parser) {
13391339
ptr++;
13401340
level++;
13411341
// can't be a code array if this is already part of a variable
1342-
if ((bc.size == 0 || bc.ptr[0] != kwTYPE_VAR) && comp_is_code_array(&bc, ptr)) {
1342+
if (comp_is_code_array(&bc, ptr)) {
13431343
// otherwise treat as array index
13441344
bc_add_fcode(&bc, kwCODEARRAY);
13451345
}

0 commit comments

Comments
 (0)