mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-28 10:44:36 +08:00
Make bytecode::Location Copy
This commit is contained in:
3 files changed
+3
-3
No files matched your search
@@ -9,7 +9,7 @@ use std::collections::{HashMap, HashSet};
|
||||
use std::fmt;
|
||||
|
||||
/// Sourcode location.
|
||||
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
|
||||
#[derive(Clone, Copy, Debug, Default, PartialEq, Serialize, Deserialize)]
|
||||
pub struct Location {
|
||||
row: usize,
|
||||
column: usize,
|
||||
|
||||
@@ -15,7 +15,7 @@ impl From<Vec<InstructionMetadata>> for InstructionMetadata {
|
||||
fn from(metas: Vec<Self>) -> Self {
|
||||
debug_assert!(!metas.is_empty(), "`metas` must not be empty");
|
||||
InstructionMetadata {
|
||||
loc: metas[0].loc.clone(),
|
||||
loc: metas[0].loc,
|
||||
labels: metas
|
||||
.into_iter()
|
||||
.flat_map(|meta| meta.labels.into_iter())
|
||||
|
||||
+1
-1
@@ -1348,7 +1348,7 @@ impl Frame {
|
||||
}
|
||||
|
||||
pub fn get_lineno(&self) -> bytecode::Location {
|
||||
self.code.locations[self.lasti.get()].clone()
|
||||
self.code.locations[self.lasti.get()]
|
||||
}
|
||||
|
||||
fn push_block(&self, typ: BlockType) {
|
||||
|
||||
Reference in new issue
Block a user