mirror of
https://github.com/pocketpy/pocketpy
synced 2026-02-04 06:30:17 +00:00
discard '_'
This commit is contained in:
parent
d6052da6ab
commit
1e2135e153
@ -1254,6 +1254,10 @@ static int Ctx__add_const(Ctx* self, py_Ref v) {
|
||||
}
|
||||
|
||||
static void Ctx__emit_store_name(Ctx* self, NameScope scope, py_Name name, int line) {
|
||||
if(name == py_name("_")) {
|
||||
Ctx__emit_(self, OP_POP_TOP, BC_NOARG, line);
|
||||
return;
|
||||
}
|
||||
switch(scope) {
|
||||
case NAME_LOCAL: Ctx__emit_(self, OP_STORE_FAST, Ctx__add_varname(self, name), line); break;
|
||||
case NAME_GLOBAL: {
|
||||
@ -2593,9 +2597,7 @@ __EAT_DOTS_END:
|
||||
}
|
||||
Ctx__emit_store_name(ctx(), name_scope(self), py_namev(name), prev()->line);
|
||||
} while(match(TK_COMMA));
|
||||
if(has_bracket) {
|
||||
consume(TK_RPAREN);
|
||||
}
|
||||
if(has_bracket) { consume(TK_RPAREN); }
|
||||
Ctx__emit_(ctx(), OP_POP_TOP, BC_NOARG, BC_KEEPLINE);
|
||||
consume_end_stmt();
|
||||
return NULL;
|
||||
|
||||
@ -125,9 +125,8 @@ else:
|
||||
assert x == 2
|
||||
|
||||
# match case
|
||||
|
||||
case, _ = 1, 2
|
||||
assert case == 1 and _ == 2
|
||||
case, _1 = 1, 2
|
||||
assert case == 1 and _1 == 2
|
||||
|
||||
match (404 * 1):
|
||||
case 200:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user