pub enum PythonHIR {
Show 16 variants
Module {
name: String,
body: Vec<PythonHIR>,
meta: Metadata,
},
Function {
id: NodeId,
name: String,
params: Vec<Parameter>,
return_type: Option<Type>,
body: Vec<PythonHIR>,
decorators: Vec<String>,
visibility: Visibility,
meta: Metadata,
},
Class {
id: NodeId,
name: String,
bases: Vec<String>,
body: Vec<PythonHIR>,
decorators: Vec<String>,
meta: Metadata,
},
Call {
id: NodeId,
callee: Box<PythonHIR>,
args: Vec<PythonHIR>,
kwargs: Vec<(String, PythonHIR)>,
inferred_type: Option<Type>,
meta: Metadata,
},
Variable {
id: NodeId,
name: String,
inferred_type: Option<Type>,
meta: Metadata,
},
Assign {
id: NodeId,
target: String,
value: Box<PythonHIR>,
type_annotation: Option<Type>,
meta: Metadata,
},
Return {
id: NodeId,
value: Option<Box<PythonHIR>>,
meta: Metadata,
},
If {
id: NodeId,
condition: Box<PythonHIR>,
then_branch: Vec<PythonHIR>,
else_branch: Vec<PythonHIR>,
meta: Metadata,
},
For {
id: NodeId,
target: String,
iter: Box<PythonHIR>,
body: Vec<PythonHIR>,
orelse: Vec<PythonHIR>,
meta: Metadata,
},
While {
id: NodeId,
condition: Box<PythonHIR>,
body: Vec<PythonHIR>,
orelse: Vec<PythonHIR>,
meta: Metadata,
},
BinOp {
id: NodeId,
op: BinOp,
left: Box<PythonHIR>,
right: Box<PythonHIR>,
inferred_type: Option<Type>,
meta: Metadata,
},
UnaryOp {
id: NodeId,
op: UnaryOp,
operand: Box<PythonHIR>,
inferred_type: Option<Type>,
meta: Metadata,
},
Literal {
id: NodeId,
value: Literal,
meta: Metadata,
},
ListComp {
id: NodeId,
element: Box<PythonHIR>,
generators: Vec<Comprehension>,
meta: Metadata,
},
Attribute {
id: NodeId,
object: Box<PythonHIR>,
attr: String,
inferred_type: Option<Type>,
meta: Metadata,
},
Subscript {
id: NodeId,
object: Box<PythonHIR>,
index: Box<PythonHIR>,
inferred_type: Option<Type>,
meta: Metadata,
},
}Expand description
Python HIR node
Variants§
Module
Module (top-level)
Function
Function definition
Fields
§
visibility: VisibilityVisibility
Class
Class definition
Fields
Call
Function call
Fields
Variable
Variable reference
Fields
Assign
Assignment
Fields
Return
Return statement
If
If statement
Fields
For
For loop
Fields
While
While loop
Fields
BinOp
Binary operation
Fields
UnaryOp
Unary operation
Fields
Literal
Literal value
ListComp
List comprehension
Fields
§
generators: Vec<Comprehension>Generators
Attribute
Attribute access (obj.attr)
Fields
Subscript
Subscript (obj[index])
Implementations§
Trait Implementations§
Source§impl<'de> Deserialize<'de> for PythonHIR
impl<'de> Deserialize<'de> for PythonHIR
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for PythonHIR
Auto Trait Implementations§
impl Freeze for PythonHIR
impl RefUnwindSafe for PythonHIR
impl Send for PythonHIR
impl Sync for PythonHIR
impl Unpin for PythonHIR
impl UnwindSafe for PythonHIR
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more