From c8df427ccaa5e5a4d22e08e71a006e090d64c34f Mon Sep 17 00:00:00 2001 From: surdeus Date: Sat, 15 Jun 2024 01:00:26 +0500 Subject: [PATCH] feat: implemented the objects module. --- tests/dogs.xgo | 24 +++++++++++++++++++----- tests/import.xgo | 3 ++- xmodules/modules.go | 6 ++++-- xmodules/objects/main.go | 27 +++++++++++++++++++++++++++ xtool/main.go | 2 +- 5 files changed, 53 insertions(+), 9 deletions(-) create mode 100644 xmodules/objects/main.go diff --git a/tests/dogs.xgo b/tests/dogs.xgo index 3105e67..218e84e 100644 --- a/tests/dogs.xgo +++ b/tests/dogs.xgo @@ -1,8 +1,22 @@ +objects := import("objects") +fmt := import("fmt") + +new := func(name) { + ret := objects.new() + ret.name = name + + ret.def("bark", func(self, n){ + fmt.print(self.name, ": ") + for i:=0 ; i