Fix order of argument evaluation bug in make-instruction-parser.
authorGuillermo J. Rozas <edu/mit/csail/zurich/gjr>
Fri, 21 Aug 1987 02:21:17 +0000 (02:21 +0000)
committerGuillermo J. Rozas <edu/mit/csail/zurich/gjr>
Fri, 21 Aug 1987 02:21:17 +0000 (02:21 +0000)
v7/src/compiler/machines/vax/dsyn.scm

index 3189d6e599fdd6dbf42a4f166a98d44e379bb370..8c8f32563c997571f7ae920cdf1b0f9fe7f08d3f 100644 (file)
@@ -1,6 +1,6 @@
 #| -*-Scheme-*-
 
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/compiler/machines/vax/dsyn.scm,v 1.3 1987/08/20 19:13:58 jinx Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/compiler/machines/vax/dsyn.scm,v 1.4 1987/08/21 02:21:17 jinx Exp $
 
 Copyright (c) 1987 Massachusetts Institute of Technology
 
@@ -85,10 +85,21 @@ MIT in each case. |#
 (define (make-instruction-parser prefix operands)
   `(lambda ()
      (append ',prefix
-            (list ,@(map process-operand operands)))))
-
-(define (process-operand operand)
-  (case (car operand)
-    ((OPERAND) `(decode-operand ',(cadr operand)))
-    ((DISPLACEMENT) `(decode-displacement ,(caadr operand)))
-    (else (error "process-operand: Unknown operand kind" operand))))
+            (process-operands operands))))
+
+;; A let* is used below to force the order of evaluation.
+
+(define (process-operands operands)
+  (if (null? operands)
+      ''()
+      `(let* ((this ,(let ((operand (car operands)))
+                      (case (car operand)
+                        ((OPERAND)
+                         `(decode-operand ',(cadr operand)))
+                        ((DISPLACEMENT)
+                         `(decode-displacement ,(caadr operand)))
+                        (else
+                         (error "process-operand: Unknown operand kind"
+                                operand)))))
+             (rest ,(process-operands (cdr operands))))
+        (cons this rest))))
\ No newline at end of file