diff --git a/semen.scm b/semen.scm index dc08160..8dac182 100644 --- a/semen.scm +++ b/semen.scm @@ -1121,20 +1121,17 @@ (let ((base (second form))) (let step ((expr (walk-operand base env)) (type (expression-type base env)) - (read (list)) ; the fields walked, reversed (fields (cddr form)) (told? #f)) (if (null? fields) (copy-form-source! form expr) (let ((target (pointer-target type))) (unless (or type told?) - (sex-warning form "cannot type this; `.' reads it as a value" - (if (null? read) - base - `(|.| ,base ,@(reverse read))))) + (let ((walked (drop-right (cddr form) (length fields)))) + (sex-warning form "cannot type this; `.' reads it as a value" + (if (null? walked) base `(|.| ,base ,@walked))))) (step (list (if target '%-> 'dot-access) expr (car fields)) (field-type (or target type) (car fields)) - (cons (car fields) read) (cdr fields) (or told? (not type))))))))