We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 488f09a commit c77c912Copy full SHA for c77c912
zenlang/tests/vm_this.rs
@@ -3,7 +3,6 @@ use alloc::rc::Rc;
3
use core::cell::RefCell;
4
5
use zenlang::compiler::*;
6
-use zenlang::interop::*;
7
use zenlang::parser::*;
8
use zenlang::tokenizer::*;
9
use zenlang::value::*;
@@ -87,3 +86,32 @@ fn main {
87
86
Value::Number(4.0),
88
);
89
}
+
90
+#[test]
91
+fn vm_test_this_2() {
92
+ expect_to_return(
93
+ r#"
94
+fn f2 {
95
+ let this.hi = 3;
96
+}
97
98
+fn f {
99
+ let this.hi = 1;
100
+ let obj = {
101
+ "test" = f2
102
+ };
103
+ obj.test();
104
+ let this.hi = obj.hi - 1;
105
106
107
+fn main {
108
109
+ "test" = f,
110
111
112
+ return obj.hi;
113
+} "#
114
+ .into(),
115
+ Value::Number(2.0),
116
+ );
117
0 commit comments