From 69aaea030e08e083151aa25b8080eddd0d4c1683 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Fri, 9 Nov 2018 16:40:36 -0800 Subject: No longer passing `tree` to every compile action. Now, you can just return a LuaCode object, and it will automatically get a source from `tree` if it didn't already have a source. Plus some fixes/cleanup. --- core/io.nom | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'core/io.nom') diff --git a/core/io.nom b/core/io.nom index edeeab4..2df0999 100644 --- a/core/io.nom +++ b/core/io.nom @@ -9,17 +9,17 @@ use "core/metaprogramming.nom" (say %message) compiles to: lua> "\ ..if \%message.type == "Text" then - return LuaCode(tree.source, "print(", \(%message as lua expr), ");"); + return LuaCode("print(", \(%message as lua expr), ");"); else - return LuaCode(tree.source, "print(tostring(", \(%message as lua expr), "));"); + return LuaCode("print(tostring(", \(%message as lua expr), "));"); end" (ask %prompt) compiles to: lua> "\ ..if \%prompt.type == "Text" then - return LuaCode(tree.source, "(io.write(", \(%prompt as lua expr), ") and io.read())"); + return LuaCode("(io.write(", \(%prompt as lua expr), ") and io.read())"); else - return LuaCode(tree.source, "(io.write(tostring(", \(..) + return LuaCode("(io.write(tostring(", \(..) %prompt as lua expr .., ")) and io.read())"); end" -- cgit v1.2.3