mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-20 03:20:18 +00:00
fix a compiler bug of []
This commit is contained in:
parent
e097313c8f
commit
c0866022fb
@ -392,6 +392,7 @@ namespace pkpy{
|
||||
// a[<0> <state:1> : state<3> : state<5>]
|
||||
int state = 0;
|
||||
do{
|
||||
match_newlines_repl();
|
||||
switch(state){
|
||||
case 0:
|
||||
if(match(TK(":"))){
|
||||
@ -439,6 +440,7 @@ namespace pkpy{
|
||||
break;
|
||||
case 5: consume(TK("]")); goto __SUBSCR_END;
|
||||
}
|
||||
match_newlines_repl();
|
||||
}while(true);
|
||||
__SUBSCR_END:
|
||||
if(is_slice){
|
||||
|
@ -83,4 +83,15 @@ assert b == [1, 2, 3, 4, 5]
|
||||
|
||||
a = []
|
||||
b = [*a, 1, 2, 3, *a, *a]
|
||||
assert b == [1, 2, 3]
|
||||
assert b == [1, 2, 3]
|
||||
|
||||
assert b[
|
||||
1
|
||||
] == 2
|
||||
|
||||
assert b[0
|
||||
] == 1
|
||||
|
||||
assert b[0] == 1
|
||||
assert b[
|
||||
0] == 1
|
||||
|
Loading…
x
Reference in New Issue
Block a user