FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Newtype for `[ir::Block]` by ShaharNaveh · Pull Request #8142 · RustPython/RustPython · GitHub

Repository navigation

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .rs  (2) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
13 changes: 7 additions & 6 deletions crates/codegen/src/compile.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
use crate::{
IndexMap, IndexSet, ToPythonName,
error::{CodegenError, CodegenErrorType, InternalError, PatternUnreachableReason},
ir::{self, BlockIdx},
ir::{self, Block, BlockIdx, Blocks},
preprocess,
symboltable::{self, CompilerScope, Symbol, SymbolFlags, SymbolScope, SymbolTable},
unparse::UnparseExpr,
Expand Down Expand Up @@ -470,7 +470,7 @@ impl Compiler {
flags: CodeFlags::empty(),
source_path: source_file.name().to_owned(),
private: None,
blocks: vec![ir::Block::default()],
blocks: Blocks::from([Block::default()]),
current_block: BlockIdx::new(0),
instr_sequence: ir::InstructionSequence::new(),
instr_sequence_label_map: ir::InstructionSequenceLabelMap::new(),
Expand Down Expand Up @@ -547,8 +547,9 @@ impl Compiler {
saved_annotations_instr_sequence,
) = {
let code = self.current_code_info();

(
mem::replace(&mut code.blocks, vec![ir::Block::default()]),
mem::replace(&mut code.blocks, Blocks::from([Block::default()])),
mem::replace(&mut code.current_block, BlockIdx::new(0)),
mem::replace(&mut code.instr_sequence, ir::InstructionSequence::new()),
mem::replace(
Expand Down Expand Up @@ -1348,7 +1349,7 @@ impl Compiler {
flags,
source_path,
private,
blocks: vec![ir::Block::default()],
blocks: Blocks::from([Block::default()]),
current_block: BlockIdx::new(0),
instr_sequence: ir::InstructionSequence::new(),
instr_sequence_label_map: ir::InstructionSequenceLabelMap::new(),
Expand Down Expand Up @@ -11024,7 +11025,7 @@ impl Compiler {
unwrap_internal(self, result);
let code = self.current_code_info();
let idx = BlockIdx::new(code.blocks.len().to_u32());
code.blocks.push(ir::Block::default());
code.blocks.push(Block::default());
let result = code.push_unmapped_instr_sequence_label();
unwrap_internal(self, result);
idx
Expand All @@ -11039,7 +11040,7 @@ impl Compiler {
unwrap_internal(self, result);
let code = self.current_code_info();
let idx = BlockIdx::new(code.blocks.len().to_u32());
code.blocks.push(ir::Block::default());
code.blocks.push(Block::default());
let result = code.push_unlabeled_instr_sequence_block();
unwrap_internal(self, result);
idx
Expand Down
Loading
Loading

Back | FazBrowse Home | New Git URL