@@ -4380,8 +4380,9 @@ f(x) = yt(x)
43804380 (begin (emit `(= ,tmp ,x)) tmp)
43814381 x)))
43824382 (define (actually-return x)
4383- (let* ((x (if rett
4384- (compile (convert-for-type-decl (emit- x) rett #t lam) '() #t #f)
4383+ (let* ((x (begin0 (emit- x) (emit '(line #f))))
4384+ (x (if rett
4385+ (compile (convert-for-type-decl x rett #t lam) '() #t #f)
43854386 x))
43864387 (x (emit- x)))
43874388 (let ((pexc (pop-exc-expr catch-token-stack '())))
@@ -5046,20 +5047,26 @@ f(x) = yt(x)
50465047 (let ((e (car stmts)))
50475048 (cond ((atom? e) (emit e))
50485049 ((eq? (car e) 'line)
5049- (if (and (= current-line 0) (length= e 2) (pair? linetable))
5050- ;; (line n) after push_loc just updates the line for the new file
5051- (begin (set-lineno! (car linetable) (cadr e))
5052- (set! current-line (cadr e)))
5053- (begin
5054- (set! current-line (cadr e))
5055- (if (pair? (cddr e))
5056- (set! current-file (caddr e)))
5057- (set! linetable (cons (if (null? locstack)
5058- (make-lineinfo name current-file current-line)
5059- (make-lineinfo name current-file current-line (caar locstack)))
5060- linetable))
5061- (set! linetablelen (+ linetablelen 1))
5062- (set! current-loc linetablelen))))
5050+ (cond ((and (length= e 2) (not (cadr e)))
5051+ ;; (line #f) marks that we are entering a generated statement
5052+ ;; that should not be counted as belonging to the previous marked location,
5053+ ;; for example `return` after a not-executed `if` arm in tail position.
5054+ (set! current-loc 0))
5055+ ((and (= current-line 0) (length= e 2) (pair? linetable))
5056+ ;; (line n) after push_loc just updates the line for the new file
5057+ (begin (set-lineno! (car linetable) (cadr e))
5058+ (set! current-line (cadr e))))
5059+ (else
5060+ (begin
5061+ (set! current-line (cadr e))
5062+ (if (pair? (cddr e))
5063+ (set! current-file (caddr e)))
5064+ (set! linetable (cons (if (null? locstack)
5065+ (make-lineinfo name current-file current-line)
5066+ (make-lineinfo name current-file current-line (caar locstack)))
5067+ linetable))
5068+ (set! linetablelen (+ linetablelen 1))
5069+ (set! current-loc linetablelen)))))
50635070 ((and (length> e 2) (eq? (car e) 'meta) (eq? (cadr e) 'push_loc))
50645071 (set! locstack (cons (list current-loc current-line current-file) locstack))
50655072 (set! current-file (caddr e))
0 commit comments