summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/language/python/compile.scm38
1 files changed, 21 insertions, 17 deletions
diff --git a/modules/language/python/compile.scm b/modules/language/python/compile.scm
index 300985e..f9b0d29 100644
--- a/modules/language/python/compile.scm
+++ b/modules/language/python/compile.scm
@@ -1682,8 +1682,10 @@
(define-syntax with-return
(lambda (x)
(define (analyze ret x)
- (syntax-case x (begin let if let-syntax cond)
+ (syntax-case x (begin let if let-syntax)
((cond (p a ... b) ...)
+ (equal? (syntax->datum #'cond)
+ '(@ (guile) cond))
(with-syntax (((bb ...) (map (lambda (x) (analyze ret x)) #'(b ...))))
#'(cond (p a ... bb) ...)))
((with-self u v a ... b)
@@ -1708,29 +1710,31 @@
(if (eq? #'(b ...) '())
#'a
#`(values a b ...)))
+ ((return)
+ (equal? (syntax->datum #'return) (syntax->datum ret))
+ #`(values))
(x #'x)))
-
+
(define (is-ec ret x tail)
- (syntax-case x (let-syntax begin let if define @@ cond)
+ (syntax-case x (let-syntax begin let if define @@)
((cond (p a ... b) ...)
- (pk 'cond)
- (or
- (or-map (lambda (x) (is-ec ret x #f))
- #'(a ... ...))
- (or-map (lambda (x) (is-ec ret x tail))
- #'(b ...))))
+ (equal? (syntax->datum #'cond)
+ '(@ (guile) cond))
+ (or
+ (or-map (lambda (x) (is-ec ret x #f))
+ #'(a ... ...))
+ (or-map (lambda (x) (is-ec ret x tail))
+ #'(b ...))))
((with-self u v a ... b)
(equal? (syntax->datum #'with-self)
- '(@@ (language python compile) with-self))
- (begin
- (pk 'with-self)
- (or
- (or-map (lambda (x) (is-ec ret x #f)) #'(a ...))
- (is-ec ret #'b tail))))
+ '(@@ (language python compile) with-self))
+ (or
+ (or-map (lambda (x) (is-ec ret x #f)) #'(a ...))
+ (is-ec ret #'b tail)))
((let-syntax v a ... b)
- (pk 'let-syntax)
+ #t
(or
(or-map (lambda (x) (is-ec ret x #f)) #'(a ...))
(is-ec ret #'b tail)))
@@ -1772,7 +1776,7 @@
(is-ec ret #'p #f)
(is-ec ret #'a tail)))
- ((return a b ...)
+ ((return b ...)
(equal? (syntax->datum #'return) (syntax->datum ret))
(not tail))