diff options
Diffstat (limited to 'lib/object.nom')
| -rw-r--r-- | lib/object.nom | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/lib/object.nom b/lib/object.nom index d41557b..cb5cd3c 100644 --- a/lib/object.nom +++ b/lib/object.nom @@ -1,33 +1,29 @@ -#!/usr/bin/env nomsu -V2.2.4.3 +#!/usr/bin/env nomsu -V2.3.4.3 # This file contains the implementation of an Object-Oriented programming system. use "core" - compile [@, me] to (Lua value "self") compile [method %actions %body] to: - %lua <- (compile as (action %actions %body)) + %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 + Lua "do -- Method: \(%actions.(1).stub)\n \%lua\nend" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ parse [as %instance %body] as (..) result of: - %old_self <- (me) - (me) <- %instance + %old_self = (me) + (me) = %instance try %body and if it barfs %msg: - (me) <- %old_self + (me) = %old_self barf %msg - ..or if it succeeds: (me) <- %old_self + ..or if it succeeds: (me) = %old_self compile [object %classname extends %parent %class_body] to (..) Lua ".." @@ -58,4 +54,4 @@ compile [object %classname extends %parent %class_body] to (..) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ parse [object %classname %class_body] as (..) - object %classname extends (nil) %class_body + object %classname extends (nil) %class_body
\ No newline at end of file |
