algol60: fix passing array slot as by-reference argument (PR 9895)

svn: r12373
This commit is contained in:
Matthew Flatt 2008-11-10 14:33:51 +00:00
parent 80b462c5e5
commit 49a4a3a26f

View File

@ -316,14 +316,19 @@
(define (compile-argument arg context) (define (compile-argument arg context)
(cond (cond
[(and (a60:variable? arg) [(or (and (a60:variable? arg)
(not (let ([v (a60:variable-name arg)]) (not (let ([v (a60:variable-name arg)])
(or (procedure-variable? v context) (or (procedure-variable? v context)
(label-variable? v context) (label-variable? v context)
(primitive-variable? v context))))) (primitive-variable? v context)))))
(a60:subscript? arg))
(let ([arg (if (a60:subscript? arg)
(make-a60:variable (a60:subscript-array arg)
(list (a60:subscript-index arg)))
arg)])
`(case-lambda `(case-lambda
[() ,(compile-expression arg context 'any)] [() ,(compile-expression arg context 'any)]
[(val) ,(compile-statement (make-a60:assign (list arg) 'val) 'void context)])] [(val) ,(compile-statement (make-a60:assign (list arg) 'val) 'void context)]))]
[(identifier? arg) [(identifier? arg)
(compile-argument (make-a60:variable arg null) context)] (compile-argument (make-a60:variable arg null) context)]
[else `(lambda () ,(compile-expression arg context 'any))])) [else `(lambda () ,(compile-expression arg context 'any))]))