diff options
| author | Bruce Hill <bitbucket@bruce-hill.com> | 2018-05-26 15:04:31 -0700 |
|---|---|---|
| committer | Bruce Hill <bitbucket@bruce-hill.com> | 2018-05-26 15:04:38 -0700 |
| commit | 8cb2788e0dc514e6d6436a7a03e87e414327ec94 (patch) | |
| tree | 47c76bbc2d142c200262d3beaf4ad59fc56ca385 /lib/object.nom | |
| parent | 0b4a81191ae61d53832d85614f0bb0f2912d7a39 (diff) | |
Re-added sources.
Diffstat (limited to 'lib/object.nom')
| -rw-r--r-- | lib/object.nom | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/object.nom b/lib/object.nom index 5c73046..cf0a809 100644 --- a/lib/object.nom +++ b/lib/object.nom @@ -16,20 +16,20 @@ compile [as %instance %body] to end compile [object %classname %class_body] to - %class_id <- (=lua "Var(\(%classname as value)):as_lua_id():sub(2,-1)") + %class_id <- (=lua "Var.as_lua_id({value=\(%classname as value)}):sub(2,-1)") if: %class_id is "" %class_id <- "class" %methods <-: Lua "" %__index <- %class_id %__newindex <- "nil" - for %line in %class_body + for %line in %class_body.value if: %line.type is "Comment" do next %line if: (%line.type is "Action") and ((%line's stub) is "slots %") %slot_index_clauses <- [] %slot_newindex_clauses <- [] - %slots <- %line.2 - for %slot_index = %slot_var in %slots + %slots <- %line.value.2 + for %slot_index = %slot_var in %slots.value to %slot_index_clauses add ".." if key == \(repr %slot_var.value) or key == \(repr (%slot_var as lua expr)) then return rawget(self, \%slot_index); @@ -52,15 +52,15 @@ compile [object %classname %class_body] to do next %line assume ((%line.type is "Action") and ((%line's stub) is "action % %")) ..or barf "Only action definitions are supported inside 'object % %'" - %actions <- %line.2 - %body <- %line.3 + %actions <- %line.value.2 + %body <- %line.value.3 lua> ".." do local stubs = {} - for i, action in ipairs(\%actions) do + for i, action in ipairs(\%actions.value) do stubs[i] = action:get_stub(true) end - local lua = Lua(nil, \%class_id, "[ ", repr(stubs[1]), "] = function(self") + local lua = Lua(\(%line.source), \%class_id, "[ ", repr(stubs[1]), "] = function(self") local args = {} for i,tok in ipairs(\%actions[1]) do if tok.type == "Var" then args[#args+1] = tok end |
