From 005c2bd99d216a29ae3ea876cbb5b4f5490a2e7d Mon Sep 17 00:00:00 2001
From: dos-reis <gdr@axiomatics.org>
Date: Sat, 25 Feb 2012 22:59:04 +0000
Subject: 	* interp/compiler.boot (extractCode): Rename from 
 extractCodeAndConstructTriple.  Change Arity.  Tidy. Adjust callers.

---
 src/ChangeLog            |  5 +++++
 src/interp/compiler.boot | 15 ++++++++-------
 2 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/src/ChangeLog b/src/ChangeLog
index 1ecae768..136d1d94 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
+2012-02-25  Gabriel Dos Reis  <gdr@cs.tamu.edu>
+
+	* interp/compiler.boot (extractCode): Rename from
+	extractCodeAndConstructTriple.  Change Arity.  Tidy. Adjust callers.
+
 2012-02-25  Gabriel Dos Reis  <gdr@cs.tamu.edu>
 
 	* interp/compiler.boot (finishLambdaExpression):  Use %closure.
diff --git a/src/interp/compiler.boot b/src/interp/compiler.boot
index 4a1cd153..8d04a77a 100644
--- a/src/interp/compiler.boot
+++ b/src/interp/compiler.boot
@@ -351,20 +351,21 @@ compWithMappingMode(x,m is ["Mapping",m',:sl],oldE) ==
     [.,.,e]:= compMakeDeclaration(v,m,e)
   (vl ~= nil) and not hasFormalMapVariable(x, vl) =>
     [u,.,.] := comp([x,:vl],m',e) or return nil
-    extractCodeAndConstructTriple(u, m, oldE)
+    [extractCode(u,vl),m,oldE]
   null vl and (t := comp([x], m', e)) =>
     [u,.,.] := t
-    extractCodeAndConstructTriple(u, m, oldE)
+    [extractCode(u,nil),m,oldE]
   [u,.,.]:= comp(x,m',e) or return nil
   [.,fun] := optimizeFunctionDef [nil,["LAMBDA",vl,u]]
   [finishLambdaExpression(fun,e),m,oldE]
 
-extractCodeAndConstructTriple(u, m, oldE) ==
-  u is ['%call,fn,:.] =>
-    if fn is ['%apply,a] then fn := a
-    [fn,m,oldE]
+extractCode(u,vars) ==
+  u is ['%call,fn,: =vars] =>
+    fn is ['%apply,a] => a
+    fn is [q,:.] and q in '(ELT CONST) => ['%tref,:fn.args]
+    fn
   [op,:.,env] := u
-  [['%closure,['%function,op],env],m,oldE]
+  ['%closure,['%function,op],env]
 
 compExpression(x,m,e) ==
   $insideExpressionIfTrue: local:= true
-- 
cgit v1.2.3