bpo-36187: Remove NamedStore. (GH-12167)

NamedStore has been replaced with Store. The difference between
NamedStore and Store is handled when precess the NamedExpr node
one level upper.
This commit is contained in:
Serhiy Storchaka 2019-03-05 20:42:06 +02:00 committed by GitHub
parent adfffc7343
commit d8b3a98c90
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 103 additions and 143 deletions

View file

@ -1452,6 +1452,10 @@ symtable_visit_expr(struct symtable *st, expr_ty e)
}
switch (e->kind) {
case NamedExpr_kind:
if (st->st_cur->ste_comprehension) {
if (!symtable_extend_namedexpr_scope(st, e->v.NamedExpr.target))
VISIT_QUIT(st, 0);
}
VISIT(st, expr, e->v.NamedExpr.value);
VISIT(st, expr, e->v.NamedExpr.target);
break;
@ -1555,11 +1559,6 @@ symtable_visit_expr(struct symtable *st, expr_ty e)
VISIT(st, expr, e->v.Starred.value);
break;
case Name_kind:
/* Special-case: named expr */
if (e->v.Name.ctx == NamedStore && st->st_cur->ste_comprehension) {
if(!symtable_extend_namedexpr_scope(st, e))
VISIT_QUIT(st, 0);
}
if (!symtable_add_def(st, e->v.Name.id,
e->v.Name.ctx == Load ? USE : DEF_LOCAL))
VISIT_QUIT(st, 0);