From: David Vázquez Date: Tue, 14 May 2013 21:58:57 +0000 (+0100) Subject: A few more primitives for testing X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=df9e003234fcae17ffea5e36fb5840cd54ffc2b6;p=jscl.git A few more primitives for testing --- diff --git a/experimental/compiler.lisp b/experimental/compiler.lisp index 6b57adc..223ba08 100644 --- a/experimental/compiler.lisp +++ b/experimental/compiler.lisp @@ -470,11 +470,16 @@ (ir-convert-constant form (result-lvar))) (define-ir-translator setq (variable value) - (let ((var (make-var :name variable)) - (value-lvar (make-lvar))) - (ir-convert value value-lvar) - (let ((assign (make-assignment :variable var :value value-lvar :lvar (result-lvar)))) - (insert-node assign)))) + (let ((b (find-binding variable 'variable))) + (cond + (b + (let ((var (make-var :name variable)) + (value-lvar (make-lvar))) + (ir-convert value value-lvar) + (let ((assign (make-assignment :variable var :value value-lvar :lvar (result-lvar)))) + (insert-node assign)))) + (t + (ir-convert `(set ',variable ,value) (result-lvar)))))) (define-ir-translator progn (&body body) (mapc #'ir-convert (butlast body)) @@ -781,6 +786,17 @@ (define-primitive symbol-function (symbol)) (define-primitive symbol-value (symbol)) +(define-primitive set (symbol value)) +(define-primitive fset (symbol value)) + +(define-primitive + (&rest numbers)) +(define-primitive - (number &rest other-numbers)) + +(define-primitive consp (x)) +(define-primitive cons (x y)) +(define-primitive car (x)) +(define-primitive cdr (x)) + ;;; compiler.lisp ends here