From 86a3219e7fc3244331595819f742b365172f96ad Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Thu, 21 Jun 2018 19:12:59 -0700 Subject: 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. --- lib/object.nom | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'lib') 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 -- cgit v1.2.3