summaryrefslogtreecommitdiff
path: root/modules/language/python/compile.scm
diff options
context:
space:
mode:
authorStefan Israelsson Tampe <stefan.itampe@gmail.com>2018-03-20 17:52:27 +0100
committerStefan Israelsson Tampe <stefan.itampe@gmail.com>2018-03-20 17:52:27 +0100
commit37eac021fde1d92798a814d57afceaac1d08a31c (patch)
tree6ea651018d3cd5d702859aa8adc5ec3847168cc5 /modules/language/python/compile.scm
parentccb060a1e03d9c69e3d86b0f236c076832665192 (diff)
parentd71244f5cb87a4a61a6b341e4838a38e50142815 (diff)
resolve merge conflict
Diffstat (limited to 'modules/language/python/compile.scm')
-rw-r--r--modules/language/python/compile.scm51
1 files changed, 34 insertions, 17 deletions
diff --git a/modules/language/python/compile.scm b/modules/language/python/compile.scm
index 95878a4..80f523c 100644
--- a/modules/language/python/compile.scm
+++ b/modules/language/python/compile.scm
@@ -812,28 +812,46 @@
l)
(l l)))))))))))
+ (#:verb
+ ((_ x) x))
+
(#:scm
((_ (#:string _ s)) (with-input-from-string s read)))
(#:import
- ((_ (#:from (() nm) . #f))
- `(use-modules (language python module ,(exp vs nm))))
+ ((_ (#:from (() . nm) . #f))
+ `(use-modules (language python module ,@(map (lambda (nm) (exp vs nm))
+ nm))))
- ((_ (#:name ((ids ...) . as) ...))
+ ((_ (#:name ((ids ...) . as)) ...)
+ (pk x)
`(begin
- ,@(map (lambda (ids as)
- (let* ((syms (map (g vs exp) ids))
- (id (if as (exp vs as) (car (reverse syms)))))
- (add-prefix id)
- `(use-modules ((language python module ,@syms)
- #:prefix
- ,(string->symbol
- (string-append (symbol->string id) "."))))))
- ids as))))
-
-
-
-
+ ,@(map
+ (lambda (ids as)
+ (let ((path (map (g vs exp) ids)))
+ (if as
+ (exp
+ vs
+ `(#:expr-stmt
+ ((#:test (#:power #f ,as ())))
+ (#:assign
+ ((#:verb
+ ((@ (language python module) Module)
+ ',(reverse (append '(language python module) path))
+ ',(reverse path)))))))
+
+ (exp
+ vs
+ `(#:expr-stmt
+ ((#:test (#:power #f ,(car ids) ())))
+ (#:assign
+ ((#:verb
+ (((@ (language python module) import)
+ ((@ (language python module) Module)
+ ',(append '(language python module) path))
+ ,(exp vs (car ids))))))))))))
+ ids as))))
+
(#:for
((_ e in code . #f)
(=> next)
@@ -1131,7 +1149,6 @@
(cons 'values (map (g vs exp) l))
(exp vs (car l)))))
-
(#:expr-stmt
((_ (l ...) (#:assign))
(let ((l (map (g vs exp) l)))