mirror of
https://github.com/RustPython/RustPython.git
synced 2026-06-02 19:39:49 +09:00
Capitalize boolean constants for dis
This commit is contained in:
@@ -405,7 +405,9 @@ impl<C: Constant> BorrowedConstant<'_, C> {
|
||||
BorrowedConstant::Integer { value } => write!(f, "{}", value),
|
||||
BorrowedConstant::Float { value } => write!(f, "{}", value),
|
||||
BorrowedConstant::Complex { value } => write!(f, "{}", value),
|
||||
BorrowedConstant::Boolean { value } => write!(f, "{}", value),
|
||||
BorrowedConstant::Boolean { value } => {
|
||||
write!(f, "{}", if value { "True" } else { "False" })
|
||||
}
|
||||
BorrowedConstant::Str { value } => write!(f, "{:?}", value),
|
||||
BorrowedConstant::Bytes { value } => write!(f, "b{:?}", value.as_bstr()),
|
||||
BorrowedConstant::Code { code } => write!(f, "{:?}", code),
|
||||
@@ -800,26 +802,7 @@ impl Instruction {
|
||||
|
||||
impl fmt::Display for ConstantData {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
match self {
|
||||
ConstantData::Integer { value } => write!(f, "{}", value),
|
||||
ConstantData::Float { value } => write!(f, "{}", value),
|
||||
ConstantData::Complex { value } => write!(f, "{}", value),
|
||||
ConstantData::Boolean { value } => write!(f, "{}", value),
|
||||
ConstantData::Str { value } => write!(f, "{:?}", value),
|
||||
ConstantData::Bytes { value } => write!(f, "{:?}", value),
|
||||
ConstantData::Code { code } => write!(f, "{:?}", code),
|
||||
ConstantData::Tuple { elements } => write!(
|
||||
f,
|
||||
"({})",
|
||||
elements
|
||||
.iter()
|
||||
.map(|e| format!("{}", e))
|
||||
.collect::<Vec<_>>()
|
||||
.join(", ")
|
||||
),
|
||||
ConstantData::None => write!(f, "None"),
|
||||
ConstantData::Ellipsis => write!(f, "Ellipsis"),
|
||||
}
|
||||
self.borrow_constant().fmt_display(f)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
source: compiler/src/compile.rs
|
||||
expression: "compile_exec(\"\\\nif True and False and False:\n pass\n\")"
|
||||
---
|
||||
0 LoadConst (true)
|
||||
0 LoadConst (True)
|
||||
1 JumpIfFalse (6)
|
||||
2 LoadConst (false)
|
||||
2 LoadConst (False)
|
||||
3 JumpIfFalse (6)
|
||||
4 LoadConst (false)
|
||||
4 LoadConst (False)
|
||||
5 JumpIfFalse (6)
|
||||
>> 6 LoadConst (None)
|
||||
7 ReturnValue
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
source: compiler/src/compile.rs
|
||||
expression: "compile_exec(\"\\\nif (True and False) or (False and True):\n pass\n\")"
|
||||
---
|
||||
0 LoadConst (true)
|
||||
0 LoadConst (True)
|
||||
1 JumpIfFalse (4)
|
||||
2 LoadConst (false)
|
||||
2 LoadConst (False)
|
||||
3 JumpIfTrue (8)
|
||||
>> 4 LoadConst (false)
|
||||
>> 4 LoadConst (False)
|
||||
5 JumpIfFalse (8)
|
||||
6 LoadConst (true)
|
||||
6 LoadConst (True)
|
||||
7 JumpIfFalse (8)
|
||||
>> 8 LoadConst (None)
|
||||
9 ReturnValue
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
source: compiler/src/compile.rs
|
||||
expression: "compile_exec(\"\\\nif True or False or False:\n pass\n\")"
|
||||
---
|
||||
0 LoadConst (true)
|
||||
0 LoadConst (True)
|
||||
1 JumpIfTrue (6)
|
||||
2 LoadConst (false)
|
||||
2 LoadConst (False)
|
||||
3 JumpIfTrue (6)
|
||||
4 LoadConst (false)
|
||||
4 LoadConst (False)
|
||||
5 JumpIfFalse (6)
|
||||
>> 6 LoadConst (None)
|
||||
7 ReturnValue
|
||||
|
||||
Reference in New Issue
Block a user