[][src]Enum rustpython_bytecode::bytecode::Instruction

pub enum Instruction {
    Import {
        name: Option<String>,
        symbols: Vec<String>,
        level: usize,
    },
    ImportStar,
    ImportFrom {
        name: String,
    },
    LoadName {
        name: String,
        scope: NameScope,
    },
    StoreName {
        name: String,
        scope: NameScope,
    },
    DeleteName {
        name: String,
    },
    Subscript,
    StoreSubscript,
    DeleteSubscript,
    StoreAttr {
        name: String,
    },
    DeleteAttr {
        name: String,
    },
    LoadConst {
        value: Constant,
    },
    UnaryOperation {
        op: UnaryOperator,
    },
    BinaryOperation {
        op: BinaryOperator,
        inplace: bool,
    },
    LoadAttr {
        name: String,
    },
    CompareOperation {
        op: ComparisonOperator,
    },
    Pop,
    Rotate {
        amount: usize,
    },
    Duplicate,
    GetIter,
    Continue,
    Break,
    Jump {
        target: Label,
    },
    JumpIfTrue {
        target: Label,
    },
    JumpIfFalse {
        target: Label,
    },
    JumpIfTrueOrPop {
        target: Label,
    },
    JumpIfFalseOrPop {
        target: Label,
    },
    MakeFunction,
    CallFunction {
        typ: CallType,
    },
    ForIter {
        target: Label,
    },
    ReturnValue,
    YieldValue,
    YieldFrom,
    SetupLoop {
        start: Label,
        end: Label,
    },
    SetupFinally {
        handler: Label,
    },
    EnterFinally,
    EndFinally,
    SetupExcept {
        handler: Label,
    },
    SetupWith {
        end: Label,
    },
    WithCleanupStart,
    WithCleanupFinish,
    PopBlock,
    Raise {
        argc: usize,
    },
    BuildString {
        size: usize,
    },
    BuildTuple {
        size: usize,
        unpack: bool,
    },
    BuildList {
        size: usize,
        unpack: bool,
    },
    BuildSet {
        size: usize,
        unpack: bool,
    },
    BuildMap {
        size: usize,
        unpack: bool,
        for_call: bool,
    },
    BuildSlice {
        size: usize,
    },
    ListAppend {
        i: usize,
    },
    SetAdd {
        i: usize,
    },
    MapAdd {
        i: usize,
    },
    PrintExpr,
    LoadBuildClass,
    UnpackSequence {
        size: usize,
    },
    UnpackEx {
        before: usize,
        after: usize,
    },
    FormatValue {
        conversion: Option<ConversionFlag>,
    },
    PopException,
    Reverse {
        amount: usize,
    },
    GetAwaitable,
    BeforeAsyncWith,
    SetupAsyncWith {
        end: Label,
    },
    GetAIter,
    GetANext,
    MapAddRev {
        i: usize,
    },
}

A Single bytecode instruction.

Variants

Import

Fields of Import

name: Option<String>symbols: Vec<String>level: usize
ImportStar
ImportFrom

Fields of ImportFrom

name: String
LoadName

Fields of LoadName

name: Stringscope: NameScope
StoreName

Fields of StoreName

name: Stringscope: NameScope
DeleteName

Fields of DeleteName

name: String
Subscript
StoreSubscript
DeleteSubscript
StoreAttr

Fields of StoreAttr

name: String
DeleteAttr

Fields of DeleteAttr

name: String
LoadConst

Fields of LoadConst

value: Constant
UnaryOperation

Fields of UnaryOperation

op: UnaryOperator
BinaryOperation

Fields of BinaryOperation

op: BinaryOperatorinplace: bool
LoadAttr

Fields of LoadAttr

name: String
CompareOperation

Fields of CompareOperation

op: ComparisonOperator
Pop
Rotate

Fields of Rotate

amount: usize
Duplicate
GetIter
Continue
Break
Jump

Fields of Jump

target: Label
JumpIfTrue

Pop the top of the stack, and jump if this value is true.

Fields of JumpIfTrue

target: Label
JumpIfFalse

Pop the top of the stack, and jump if this value is false.

Fields of JumpIfFalse

target: Label
JumpIfTrueOrPop

Peek at the top of the stack, and jump if this value is true. Otherwise, pop top of stack.

Fields of JumpIfTrueOrPop

target: Label
JumpIfFalseOrPop

Peek at the top of the stack, and jump if this value is false. Otherwise, pop top of stack.

Fields of JumpIfFalseOrPop

target: Label
MakeFunction
CallFunction

Fields of CallFunction

typ: CallType
ForIter

Fields of ForIter

target: Label
ReturnValue
YieldValue
YieldFrom
SetupLoop

Fields of SetupLoop

start: Labelend: Label
SetupFinally

Setup a finally handler, which will be called whenever one of this events occurs:

  • the block is popped
  • the function returns
  • an exception is returned

Fields of SetupFinally

handler: Label
EnterFinally

Enter a finally block, without returning, excepting, just because we are there.

EndFinally

Marker bytecode for the end of a finally sequence. When this bytecode is executed, the eval loop does one of those things:

  • Continue at a certain bytecode position
  • Propagate the exception
  • Return from a function
  • Do nothing at all, just continue
SetupExcept

Fields of SetupExcept

handler: Label
SetupWith

Fields of SetupWith

end: Label
WithCleanupStart
WithCleanupFinish
PopBlock
Raise

Fields of Raise

argc: usize
BuildString

Fields of BuildString

size: usize
BuildTuple

Fields of BuildTuple

size: usizeunpack: bool
BuildList

Fields of BuildList

size: usizeunpack: bool
BuildSet

Fields of BuildSet

size: usizeunpack: bool
BuildMap

Fields of BuildMap

size: usizeunpack: boolfor_call: bool
BuildSlice

Fields of BuildSlice

size: usize
ListAppend

Fields of ListAppend

i: usize
SetAdd

Fields of SetAdd

i: usize
MapAdd

Fields of MapAdd

i: usize
PrintExpr
LoadBuildClass
UnpackSequence

Fields of UnpackSequence

size: usize
UnpackEx

Fields of UnpackEx

before: usizeafter: usize
FormatValue

Fields of FormatValue

conversion: Option<ConversionFlag>
PopException
Reverse

Fields of Reverse

amount: usize
GetAwaitable
BeforeAsyncWith
SetupAsyncWith

Fields of SetupAsyncWith

end: Label
GetAIter
GetANext
MapAddRev

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.

Fields of MapAddRev

i: usize

Trait Implementations

impl Clone for Instruction[src]

impl Debug for Instruction[src]

impl<'de> Deserialize<'de> for Instruction[src]

impl PartialEq<Instruction> for Instruction[src]

impl Serialize for Instruction[src]

impl StructuralPartialEq for Instruction[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.