Skip to content

Commit 1998b7d

Browse files
committed
fixed bug where recursivly setting variable would lose new value
1 parent 7233d64 commit 1998b7d

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/eval.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ pub struct NewList {
9494
}
9595

9696
impl NewList {
97-
pub fn new(thing: &mut Vec<LiteralOrFile>) -> Self {
97+
pub fn new(mut thing: Vec<LiteralOrFile>) -> Self {
9898
Self {
9999
car: LitOrList::Literal(thing.remove(0)),
100100
cdr: LitOrList::Literal(thing.remove(0)),
@@ -225,8 +225,8 @@ impl Scope {
225225
// and also less typing instead of creating a NewIdentifierType you just pass in a vector of LiteralType
226226
let new_val: NewIdentifierType = match value.len() {
227227
0 => error(line, "expected Identifier, got empty list"),
228-
1 => NewIdentifierType::Vairable(Box::new(NewVairable::new(value.remove(0)))),
229-
2 => NewIdentifierType::List(Box::new(NewList::new(value))),
228+
1 => NewIdentifierType::Vairable(Box::new(NewVairable::new(value.clone().remove(0)))),
229+
2 => NewIdentifierType::List(Box::new(NewList::new(value.clone()))),
230230
_ => error(
231231
line,
232232
"expected Identifier, got list with more than 2 elements",

src/token.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ impl TokenType {
415415
}
416416
}
417417
} else {
418-
error::error(line, "Unknown keyword");
418+
error::error(line, format!("Unknown keyword, {}", self));
419419
}
420420
}
421421
}

0 commit comments

Comments
 (0)