mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-07-09 14:07:34 +02:00
Fixing bug in the non-strict top-level identifier matching logic.
Matching worked when both bindings were missing, and when both bindings were present at the top-level but different. The case when only one top-level binding was present wasn't handled correctly. Local lexical matching remains unchanged. Fixes issue #198.
This commit is contained in:
parent
363d2bda24
commit
7a5f317811
1 changed files with 6 additions and 3 deletions
9
eval.c
9
eval.c
|
@ -592,9 +592,12 @@ sexp sexp_identifier_eq_op (sexp ctx, sexp self, sexp_sint_t n, sexp e1, sexp id
|
||||||
else if (!cell1 && !cell2 && (id1 == id2))
|
else if (!cell1 && !cell2 && (id1 == id2))
|
||||||
return SEXP_TRUE;
|
return SEXP_TRUE;
|
||||||
#if ! SEXP_USE_STRICT_TOPLEVEL_BINDINGS
|
#if ! SEXP_USE_STRICT_TOPLEVEL_BINDINGS
|
||||||
else if (cell1 && !sexp_lambdap(sexp_cdr(cell1))
|
/* If the identifiers are the same and the cells are either unbound *
|
||||||
&& cell2 && !sexp_lambdap(sexp_cdr(cell2))
|
* or bound to top-level variables, consider them the same. Local *
|
||||||
&& (id1 == id2))
|
* (non-toplevel) bindings must still match exactly. */
|
||||||
|
else if ((id1 == id2)
|
||||||
|
&& (!cell1 || !sexp_lambdap(sexp_cdr(cell1)))
|
||||||
|
&& (!cell2 || !sexp_lambdap(sexp_cdr(cell2))))
|
||||||
return SEXP_TRUE;
|
return SEXP_TRUE;
|
||||||
#endif
|
#endif
|
||||||
return SEXP_FALSE;
|
return SEXP_FALSE;
|
||||||
|
|
Loading…
Add table
Reference in a new issue