Cleaning up code to make use of newer API.
This commit is contained in:
parent
723eb9e1f1
commit
3cf97066be
@ -45,9 +45,7 @@ test:
|
|||||||
|
|
||||||
compile [@, me] to (Lua value "self")
|
compile [@, me] to (Lua value "self")
|
||||||
compile [method %actions %body] to:
|
compile [method %actions %body] to:
|
||||||
%lua = (compile as (action %actions %body))
|
%lua = (compile as (local action %actions %body))
|
||||||
add free vars ((% as lua id) for % in %actions) to %lua
|
|
||||||
declare locals in %lua
|
|
||||||
for % in %actions:
|
for % in %actions:
|
||||||
to %lua write "\nclass.\(% as lua id) = \(% as lua id)"
|
to %lua write "\nclass.\(% as lua id) = \(% as lua id)"
|
||||||
return (..)
|
return (..)
|
||||||
@ -90,7 +88,9 @@ compile [object %classname extends %parent %class_body] to (..)
|
|||||||
|
|
||||||
\(%class_body as lua statements)
|
\(%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
|
end
|
||||||
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
Loading…
Reference in New Issue
Block a user