Issue #257 - Prevent possible infinite loop

This commit is contained in:
Justin Ethier 2018-05-04 02:17:01 +00:00
parent 09b6472ce0
commit c1cdad0065
2 changed files with 3 additions and 1 deletions

View file

@ -16,6 +16,7 @@ Bug Fixes
- Fixed an off-by-one error in `read-line` where the function erroneously reported an extra character was read from `stdin`. Thanks to wasamasa for the bug report.
- Fixed a CPS optimization issue where multiple copies of the same lambda are introduced during beta expansion, which causes the optimizer to potentially pick up the wrong value when optimizing-out function calls later on. Thanks to @Chant on Github for providing the report and a test program demonstrating the issue.
- Updated the parser to recognize mnemonic escapes (EG: `\n`, `\a`, etc) and inline hex escapes as part of a symbol.
- Prevent a possible infinite loop during beta expansion optimization.
## 0.7.2 - February 15, 2018

View file

@ -1377,7 +1377,8 @@
(map cons (ast:lambda-args fnc) (cdr exp)))
(define (replace ref renamed)
(let ((r (assoc ref formals/actuals)))
(if r
(if (and r
(not (eq? (car r) (cdr r)))) ;; Prevent an inf loop
(scan (cdr r) renamed)
;ref
(let ((rn (assoc ref renamed)))