Remove unused imports in parser.rs
Box return values in LoxError - Box Return.value in LoxError - Deref boxed value when assigning to ret - Box value when constructing Return variants - Update Cargo.toml edition to 2024 and add nightly toolchain
This commit is contained in:
@@ -112,7 +112,7 @@ impl Interpreter {
|
||||
match self.eval_expr(body) {
|
||||
Ok(val) => ret = val,
|
||||
Err(LoxError::Return { value, .. }) => {
|
||||
ret = value;
|
||||
ret = *value;
|
||||
break;
|
||||
}
|
||||
Err(err) => return Err(err),
|
||||
@@ -136,7 +136,7 @@ impl Interpreter {
|
||||
match self.eval_expr(body) {
|
||||
Ok(val) => ret = val,
|
||||
Err(LoxError::Return { value, .. }) => {
|
||||
ret = value;
|
||||
ret = *value;
|
||||
break;
|
||||
}
|
||||
Err(err) => return Err(err),
|
||||
@@ -217,7 +217,7 @@ impl Interpreter {
|
||||
// Execute the function body
|
||||
let result = match self.eval_expr(&func.body) {
|
||||
Ok(value) => Ok(value),
|
||||
Err(LoxError::Return { value, .. }) => Ok(value),
|
||||
Err(LoxError::Return { value, .. }) => Ok(*value),
|
||||
Err(err) => Err(err),
|
||||
};
|
||||
|
||||
@@ -328,7 +328,7 @@ impl Interpreter {
|
||||
|
||||
result = Err(LoxError::Return {
|
||||
source_slice: statement.source_slice.clone(),
|
||||
value,
|
||||
value: Box::new(value),
|
||||
return_label: "Hi".to_string(),
|
||||
});
|
||||
break;
|
||||
|
||||
@@ -28,7 +28,7 @@ pub enum LoxError {
|
||||
},
|
||||
Return {
|
||||
source_slice: SourceSlice,
|
||||
value: BaseValue,
|
||||
value: Box<BaseValue>,
|
||||
return_label: String,
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user