forked from Rust-related/RustPython
minor optimization
This commit is contained in:
27
pdc.sh
Executable file
27
pdc.sh
Executable file
@@ -0,0 +1,27 @@
|
||||
RUSTPYTHONPATH=Lib
|
||||
export RUSTPYTHONPATH
|
||||
|
||||
ACTIONS=("cargo build" "cargo build --release" "cargo fmt --all" "cargo clippy --all -- -Dwarnings" "cargo test --all" "cargo run --release -- -m test -v" "cd tests" "pytest" "cd ..")
|
||||
ACT_RES=0
|
||||
FAILS=()
|
||||
|
||||
for act in "${ACTIONS[@]}"; do
|
||||
$act
|
||||
if ! [ $? -eq 0 ]; then
|
||||
ACT_RES=1
|
||||
FAILS+=("${act}")
|
||||
fi
|
||||
done
|
||||
|
||||
echo
|
||||
echo
|
||||
echo "*********************"
|
||||
if ! [ $ACT_RES -eq 0 ]; then
|
||||
echo "PDC failed"
|
||||
for el in "${FAILS[@]}"; do
|
||||
echo " Fail ${el}"
|
||||
done
|
||||
echo
|
||||
else
|
||||
echo "PDC passed"
|
||||
fi
|
||||
@@ -114,13 +114,7 @@ impl NameProtocol for Scope {
|
||||
|
||||
fn store_cell(&self, vm: &VirtualMachine, name: &str, value: PyObjectRef) {
|
||||
// find the innermost outer scope that contains the symbol name
|
||||
if let Some(locals) = self
|
||||
.locals
|
||||
.iter()
|
||||
.rev()
|
||||
.filter(|l| l.contains_key(name, vm))
|
||||
.nth(0)
|
||||
{
|
||||
if let Some(locals) = self.locals.iter().rev().find(|l| l.contains_key(name, vm)) {
|
||||
// add to the symbol
|
||||
locals.set_item(name, value, vm).unwrap();
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user