Cleaning up code to make use of newer API.

This commit is contained in:
Bruce Hill 2018-07-24 14:07:25 -07:00
parent 723eb9e1f1
commit 3cf97066be

View File

@ -45,9 +45,7 @@ test:
compile [@, me] to (Lua value "self")
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
%lua = (compile as (local action %actions %body))
for % in %actions:
to %lua write "\nclass.\(% as lua id) = \(% as lua id)"
return (..)
@ -90,7 +88,9 @@ compile [object %classname extends %parent %class_body] to (..)
\(%class_body as lua statements)
class.__tostring = class["A"..string.as_lua_id("as text")]
class.__tostring = class["A"..string.as_lua_id("as text")] or function(inst)
return inst.name..getmetatable(dict{}).__tostring(inst)
end
end
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~