Skip to content

Commit 713a246

Browse files
committed
COMMON: Fix square bracket field access issue
1 parent 2af7db7 commit 713a246

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

samples/distro-examples/tests/array.bas

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,4 +321,9 @@ dim j(0 to 1, 0 to 1)
321321
j[0, 0].translation = [1,2,3]
322322
k.framePoses = j
323323
anims << k
324+
sub xfunc(argx)
325+
local xx=[1,2,3]
326+
if xx!=argx then throw "err"
327+
end
324328
z=anims[0].framePoses[0, 0].translation
329+
xfunc(anims[0].framePoses[0, 0].translation)

src/common/scan.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1110,6 +1110,10 @@ int comp_is_code_array(bc_t *bc, char *p) {
11101110
}
11111111
p++;
11121112
}
1113+
if (*p == '.') {
1114+
// a[1].foo is not a code array
1115+
result = 0;
1116+
}
11131117
if (!count) {
11141118
result = 1;
11151119
}

0 commit comments

Comments
 (0)