fix handling of code compiled to ignore

When the compiler sees `(if #f A B)`, it compiles A in a throwaway
mode, but the throwaway mode need to produce a slightly more plausible
result than it was so that further throwaway transformation is not
confused.
This commit is contained in:
Matthew Flatt 2014-03-16 09:15:19 -06:00
parent 40f3bf1810
commit 6182541889
2 changed files with 15 additions and 1 deletions

View File

@ -3375,6 +3375,20 @@
(call-with-continuation-prompt g p)
(call-with-continuation-prompt g p)))
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Make sure the compiler isn't confused by
;; throwaway internal-definition expansion:
(test #t procedure?
(eval '(lambda (db)
(if #f
(let ()
(define matches
(let loop ()
(define s db)
null))
5)
(void)))))
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

View File

@ -1777,7 +1777,7 @@ scheme_lookup_binding(Scheme_Object *find_id, Scheme_Comp_Env *env, int flags,
*_lexical_binding_id = val;
}
if (flags & SCHEME_DONT_MARK_USE)
return scheme_make_local(scheme_local_type, 0, 0);
return scheme_make_local(scheme_local_type, p+i, 0);
else
return (Scheme_Object *)get_frame_loc(frame, i, j, p, flags);
}