File tree Expand file tree Collapse file tree 4 files changed +11
-11
lines changed
Expand file tree Collapse file tree 4 files changed +11
-11
lines changed Original file line number Diff line number Diff line change 11//! Value
22//!
33//! ZenLang variable value
4- use crate :: environment:: Environment ;
54use crate :: strong_u64:: U64BitsControl ;
65use crate :: vm:: VM ;
76use alloc:: collections:: btree_map:: BTreeMap ;
Original file line number Diff line number Diff line change @@ -2,8 +2,6 @@ use crate::strong_u64::U64BitsControl;
22use crate :: value:: * ;
33use crate :: vm:: VM ;
44use alloc:: format;
5- use alloc:: rc:: Rc ;
6- //use alloc::rc::Rc;
75use alloc:: string:: * ;
86
97impl VM {
Original file line number Diff line number Diff line change 1- use core:: cell:: RefCell ;
2-
3- use crate :: environment;
41use crate :: environment:: Environment ;
52use crate :: module:: Module ;
63use crate :: platform:: Platform ;
74use crate :: strong_u64:: * ;
85use crate :: value:: * ;
96use alloc:: boxed:: * ;
107use alloc:: format;
11- use alloc:: rc:: * ;
128use alloc:: string:: * ;
139use 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
Original file line number Diff line number Diff line change @@ -332,6 +332,9 @@ fn vm_test_stdlib_clone() {
332332fn 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}
You can’t perform that action at this time.
0 commit comments