Skip to content

Commit 53f329c

Browse files
committed
FINALLY
1 parent 498ae95 commit 53f329c

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

zenlang/src/value.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
//! Value
22
//!
33
//! ZenLang variable value
4-
use crate::environment::Environment;
54
use crate::strong_u64::U64BitsControl;
65
use crate::vm::VM;
76
use alloc::collections::btree_map::BTreeMap;

zenlang/src/vm/opcodes/vm_call.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ use crate::strong_u64::U64BitsControl;
22
use crate::value::*;
33
use crate::vm::VM;
44
use alloc::format;
5-
use alloc::rc::Rc;
6-
//use alloc::rc::Rc;
75
use alloc::string::*;
86

97
impl VM {

zenlang/src/vm/vm.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
1-
use core::cell::RefCell;
2-
3-
use crate::environment;
41
use crate::environment::Environment;
52
use crate::module::Module;
63
use crate::platform::Platform;
74
use crate::strong_u64::*;
85
use crate::value::*;
96
use alloc::boxed::*;
107
use alloc::format;
11-
use alloc::rc::*;
128
use alloc::string::*;
139
use alloc::vec::*;
1410

@@ -210,11 +206,15 @@ impl VM {
210206
return true;
211207
}
212208

209+
for environ in self.environs_stack.iter() {
210+
if *environ == id {
211+
return true;
212+
}
213+
}
214+
213215
for value in self.stack.iter() {
214-
if let Value::FunctionRefEnv(_, _, i) = value {
215-
if *i == id {
216-
return true;
217-
}
216+
if self.is_environ_used_in(id, value) {
217+
return true;
218218
}
219219
}
220220

zenlang/tests/vm_stdlib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,9 @@ fn vm_test_stdlib_clone() {
332332
fn main {
333333
let a1 = [1,2,3];
334334
let a2 = clone(a1);
335+
if a2 == null {
336+
return "a2 is null!";
337+
}
335338
let a1[0] = 0;
336339
return a2[0];
337340
}

0 commit comments

Comments
 (0)