From 5df50ecccae28fc41461637b7bde1cdb383da30e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustav=20S=C3=B6rn=C3=A4s?= Date: Fri, 29 Jan 2021 20:14:51 +0100 Subject: blobs in blobs --- TODO | 1 - src/vm.rs | 4 ---- tests/simple.tdy | 10 ++++++++-- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/TODO b/TODO index e8657bf..84e970d 100644 --- a/TODO +++ b/TODO @@ -1,5 +1,4 @@ PONG -- structs in structs - foreign function - constructors? ({.x = }-ish) - foreign structs diff --git a/src/vm.rs b/src/vm.rs index 2b5b2bf..0fb38ea 100644 --- a/src/vm.rs +++ b/src/vm.rs @@ -596,10 +596,6 @@ impl VM { values.push(Value::Nil); } - for (slot, ty) in blob.name_to_field.values() { - values[*slot] = ty.as_value(); - } - self.stack.pop(); self.stack.push(Value::BlobInstance(blob_id, Rc::new(RefCell::new(values)))); } diff --git a/tests/simple.tdy b/tests/simple.tdy index de6841b..7ecac8b 100644 --- a/tests/simple.tdy +++ b/tests/simple.tdy @@ -1,18 +1,24 @@ +blob B { + a: int +} + blob A { a: int - b: int + b: B c: float } hello : fn A -> = fn a: A { print a.a print a.b + print a.b.a print a.c } a := A() a.a = 1 -a.b = 2 +a.b = B() +a.b.a = 2 a.c = 3. hello(a) -- cgit v1.2.1