summaryrefslogtreecommitdiff
path: root/libguile/eq.c
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2017-04-21 11:04:08 +0200
committerAndy Wingo <wingo@pobox.com>2017-04-21 11:56:51 +0200
commit2e5f7d8f6d8e0e66a964ec69ccdca4f737b0b018 (patch)
treef30595509e51d459ced6857ebf47be4184126966 /libguile/eq.c
parent02cf38514d85182ee5b1f89968d5052b1e3b40ca (diff)
downloadguile-2e5f7d8f6d8e0e66a964ec69ccdca4f737b0b018.tar.gz
Syntax objects are comparable with equal?
* libguile/eq.c (scm_equal_p, scm_raw_ihash): Add cases for syntax objects, which should be comparable with equal?. * test-suite/tests/syntax.test ("syntax objects"): Add tests.
Diffstat (limited to 'libguile/eq.c')
-rw-r--r--libguile/eq.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/libguile/eq.c b/libguile/eq.c
index bbb061655..4680de7d8 100644
--- a/libguile/eq.c
+++ b/libguile/eq.c
@@ -33,6 +33,7 @@
#include "libguile/vectors.h"
#include "libguile/hashtab.h"
#include "libguile/bytevectors.h"
+#include "libguile/syntax.h"
#include "libguile/struct.h"
#include "libguile/goops.h"
@@ -362,6 +363,16 @@ scm_equal_p (SCM x, SCM y)
case scm_tc7_vector:
case scm_tc7_wvect:
return scm_i_vector_equal_p (x, y);
+ case scm_tc7_syntax:
+ if (scm_is_false (scm_equal_p (scm_syntax_wrap (x),
+ scm_syntax_wrap (y))))
+ return SCM_BOOL_F;
+ if (scm_is_false (scm_equal_p (scm_syntax_module (x),
+ scm_syntax_module (y))))
+ return SCM_BOOL_F;
+ x = scm_syntax_expression (x);
+ y = scm_syntax_expression (y);
+ goto tailrecurse;
}
/* Otherwise just return false. Dispatching to the generic is the wrong thing