Browse files

[cl-backend] handle class Foo {...}

  • Loading branch information...
1 parent ac81267 commit b246ee308af03aa0a4ea77dce46e9b41e6301bcf @pmurias pmurias committed Feb 10, 2011
Showing with 7 additions and 4 deletions.
  1. +7 −4 cl-backend/backend.lisp
View
11 cl-backend/backend.lisp
@@ -239,27 +239,30 @@
(defun fstash (prefix node)
(fare-matcher:match node
((and (list name var Xref ChildNode) (when (equal var "var")))
- (let ((stash-entry (if Xref (list (cons (append prefix (list name)) (list Xref))) '())))
- (append stash-entry (fstash-list (cons name prefix) ChildNode))))))
+ (cons (list (append prefix (list name)) Xref) (fstash-list (cons name prefix) ChildNode)))))
+
(defun fstash-list (prefix nodes) (apply 'append (mapcar #'(lambda (x) (fstash prefix x)) nodes)))
+
(defun fstash-to-let (stash body)
`(let
,(mapcar (lambda (x) (list (to-stash-name (first x)) nil)) (hide-foreign stash))
,@body
,@(fstash-to-setf stash)
))
+(defun only-with-xrefs (stash) (remove-if (lambda (x) (not (second x))) stash))
+
(defun fstash-to-setf (stash)
- (mapcar (lambda (x) `(setf ,(to-stash-name (first x)) ,(xref-to-symbol (second x)))) (hide-foreign stash)))
+ (mapcar (lambda (x) `(setf ,(to-stash-name (first x)) ,(xref-to-symbol (second x)))) (only-with-xrefs (hide-foreign stash))))
(defun hide-foreign (stash)
(remove-if
(lambda (x)
- (not (equal (first (second x)) "MAIN")))
+ (and (second x) (not (equal (first (second x)) "MAIN"))))
stash))

0 comments on commit b246ee3

Please sign in to comment.