mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-29 03:04:38 +08:00
Implement Py38 named expression (PEP 572) (#1934)
* Initial implementation of named expression and import according CPython tests * added new instruction with inversed evaluation order for dict comprehension, in other cases use regular evaluation order * added further aspects to implementation, cleaned up, imported test from CPython * implemented first parts of scoping enhancement and extended checks * completion of name resolution ongoing, now more test passing, still warinings and cleanup required * further optimization of name resolution in nested scopes * Initialize the vm with imports from _io instead of io * Add the OpenBSD support that I am smart enough to * adapted grammer to full support, most test are passing now, esp. all invalids are passed. Cleaned up in symboltable * more conditional compiling, this time for errors * rustfmt was not pleased * premature push, whoops * Add expected_failure result type to jsontests * Initial implementation of named expression and import according CPython tests * added new instruction with inversed evaluation order for dict comprehension, in other cases use regular evaluation order * added further aspects to implementation, cleaned up, imported test from CPython * implemented first parts of scoping enhancement and extended checks * completion of name resolution ongoing, now more test passing, still warinings and cleanup required * further optimization of name resolution in nested scopes * adapted grammer to full support, most test are passing now, esp. all invalids are passed. Cleaned up in symboltable * Fixed nameing convention violation and removed unnecessary information from symbol resolution. Added some more comments. * Fixed nameing convention violation and removed unnecessary information from symbol resolution. Added some more comments. Co-authored-by: Noah <33094578+coolreader18@users.noreply.github.com> Co-authored-by: Reuben Staley <lighthousemaniac@gmail.com>
This commit is contained in:
10 files changed
+821
-60
No files matched your search
@@ -273,6 +273,7 @@ pub enum Instruction {
|
||||
MapAdd {
|
||||
i: usize,
|
||||
},
|
||||
|
||||
PrintExpr,
|
||||
LoadBuildClass,
|
||||
UnpackSequence {
|
||||
@@ -296,6 +297,13 @@ pub enum Instruction {
|
||||
},
|
||||
GetAIter,
|
||||
GetANext,
|
||||
|
||||
/// Reverse order evaluation in MapAdd
|
||||
/// required to support named expressions of Python 3.8 in dict comprehension
|
||||
/// today (including Py3.9) only required in dict comprehension.
|
||||
MapAddRev {
|
||||
i: usize,
|
||||
},
|
||||
}
|
||||
|
||||
use self::Instruction::*;
|
||||
@@ -586,7 +594,7 @@ impl Instruction {
|
||||
BuildSlice { size } => w!(BuildSlice, size),
|
||||
ListAppend { i } => w!(ListAppend, i),
|
||||
SetAdd { i } => w!(SetAdd, i),
|
||||
MapAdd { i } => w!(MapAdd, i),
|
||||
MapAddRev { i } => w!(MapAddRev, i),
|
||||
PrintExpr => w!(PrintExpr),
|
||||
LoadBuildClass => w!(LoadBuildClass),
|
||||
UnpackSequence { size } => w!(UnpackSequence, size),
|
||||
@@ -597,6 +605,7 @@ impl Instruction {
|
||||
GetAwaitable => w!(GetAwaitable),
|
||||
GetAIter => w!(GetAIter),
|
||||
GetANext => w!(GetANext),
|
||||
MapAdd { i } => w!(MapAdd, i),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user