aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBruce Hill <bitbucket@bruce-hill.com>2018-06-21 19:12:59 -0700
committerBruce Hill <bitbucket@bruce-hill.com>2018-06-21 19:13:47 -0700
commit86a3219e7fc3244331595819f742b365172f96ad (patch)
tree948a3f308bd9c45b85efa2e130af8432bb1a97e2 /lib
parent7761f715f7497e8b325a4f1134869f332848fd16 (diff)
Cleanup of some metaprogramming stuff, as well as adding support for
"package.nomsupath" to search for files in different locations, and prioritizing use of "luafilesystem" over system calls.
Diffstat (limited to 'lib')
-rw-r--r--lib/object.nom22
1 files changed, 11 insertions, 11 deletions
diff --git a/lib/object.nom b/lib/object.nom
index c5c0091..5f12170 100644
--- a/lib/object.nom
+++ b/lib/object.nom
@@ -4,18 +4,18 @@
use "core"
compile [@, me] to: Lua value "self"
-compile [set methods %methods] to
- %lua <- (Lua "")
- for %m in %methods
- to %lua write "\nclass.\(%m as lua id) = \(%m as lua id)"
- return %lua
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-parse [method %actions %body] as
- with local %actions
- action %actions %body
- set methods %actions
+compile [method %actions %body] to
+ %lua <- (compile as: action %actions %body)
+ add free vars ((% as lua id) for % in %actions) to %lua
+ declare locals in %lua
+ for % in %actions
+ to %lua write "\nclass.\(% as lua id) = \(% as lua id)"
+ return
+ Lua ".."
+ do -- Method: \(%actions.1.stub)
+ \%lua
+ end
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
parse [as %instance %body] as