git » jacl.git » commit bb35477

%tagbody WIP

author Alan Dipert
2019-10-19 04:42:24 UTC
committer Alan Dipert
2019-10-19 04:42:24 UTC
parent 30af31b7980d966945ebe6fea4f1dbf9ba75240d

%tagbody WIP

jacl.js +10 -10

diff --git a/jacl.js b/jacl.js
index 61f6122..108ea15 100644
--- a/jacl.js
+++ b/jacl.js
@@ -307,7 +307,7 @@ for (const [k,v] of CLCONSTS) {
 const CLFUNCS = new Map([
   ['LIST', Cons.listOf],
   ['APPEND', Cons.append],
-  ['LIST*', Cons.listStar]
+  ['LIST*', Cons.listStar],
 ]);
 
 for (const [k,v] of CLFUNCS) {
@@ -904,11 +904,7 @@ const analyzeSpecials = new Map([
     const targetExpr = analyze(env.withContext("lval"), null, target);
     const valExpr = analyze(env.withContext("sval"), null, val);
 
-    const node = makeNode("set", {
-      env: env,
-      parent: parent,
-      form: form
-    });
+    const node = makeNode("set", { env: env, parent: parent, form: form });
 
     targetExpr.parent = valExpr.parent = node;
 
@@ -1169,7 +1165,6 @@ const emitNode = (print, node) => {
       if (context !== "sval") print(";\n");
       break;
     case "if":
-      console.log(node);
       if (context === "sval" || context === "return") {
         print("(truth(");
         emitNode(print, node.testNode);
@@ -1188,9 +1183,14 @@ const emitNode = (print, node) => {
         print("\n");
       }
       break;
-      
-    // TODO if
-    // TODO tagbody
+    case "tagbody":
+      if (context === "return") print("return ");
+      if (context === "statement") {
+        // TODO
+      } else {
+      }
+      if (context !== "sval") print(";\n");
+      break;
     // TODO lambda
     default:
       throw new Error(`Unknown op: ${op}`);