Struct erg_compiler::ty::codeobj::CodeObj
source · pub struct CodeObj {Show 18 fields
pub argcount: u32,
pub posonlyargcount: u32,
pub kwonlyargcount: u32,
pub nlocals: u32,
pub stacksize: u32,
pub flags: u32,
pub code: Vec<u8>,
pub consts: Vec<ValueObj>,
pub names: Vec<Str>,
pub varnames: Vec<Str>,
pub freevars: Vec<Str>,
pub cellvars: Vec<Str>,
pub filename: Str,
pub name: Str,
pub qualname: Str,
pub firstlineno: u32,
pub lnotab: Vec<u8>,
pub exceptiontable: Vec<u8>,
}
Expand description
Implementation of PyCodeObject
, see Include/cpython/code.h in CPython for details.
Fields§
§argcount: u32
§posonlyargcount: u32
§kwonlyargcount: u32
§nlocals: u32
§stacksize: u32
§flags: u32
§code: Vec<u8>
§consts: Vec<ValueObj>
§names: Vec<Str>
§varnames: Vec<Str>
§freevars: Vec<Str>
§cellvars: Vec<Str>
§filename: Str
§name: Str
§qualname: Str
§firstlineno: u32
§lnotab: Vec<u8>
§exceptiontable: Vec<u8>
Implementations§
source§impl CodeObj
impl CodeObj
pub fn empty<S: Into<Str>, T: Into<Str>>( params: Vec<Str>, filename: S, name: T, firstlineno: u32, flags: u32 ) -> Self
pub fn from_pyc<P: AsRef<Path>>(path: P) -> DeserializeResult<Self>
pub fn from_bytes( v: &mut Vec<u8>, python_ver: PythonVersion ) -> DeserializeResult<Self>
pub fn into_bytes(self, python_ver: PythonVersion) -> Vec<u8>
pub fn dump_as_pyc<P: AsRef<Path>>( self, path: P, py_magic_num: Option<u32> ) -> Result<()>
pub fn code_info(&self, py_ver: Option<PythonVersion>) -> String
Trait Implementations§
source§impl HasType for CodeObj
impl HasType for CodeObj
fn ref_t(&self) -> &Type
source§fn ref_mut_t(&mut self) -> &mut Type
fn ref_mut_t(&mut self) -> &mut Type
x.ref_mut_t()
may panic, in which case x
is Call
and x.ref_t() == Type::Failure
.