26 lines
826 B
Common Lisp
26 lines
826 B
Common Lisp
(in-package #:user-side-compiler)
|
|
|
|
(defclass reference ()
|
|
((%name :accessor name :initarg :name)))
|
|
|
|
(defgeneric ref-constantp (reference) (:method (reference) nil))
|
|
|
|
(defclass reference-constant (reference)
|
|
((%value :accessor ref-value :initarg :value)))
|
|
|
|
(defmethod ref-constantp ((reference reference-constant))
|
|
t)
|
|
|
|
(defmethod print-object ((object reference-constant) stream)
|
|
(print-unreadable-object (object stream :type t)
|
|
(format stream "~D" (ref-value object))))
|
|
|
|
(defmethod ref= ((a reference-constant) (b reference-constant))
|
|
(= (value a) (value b)))
|
|
|
|
(defclass reference-variable (reference)
|
|
((%index :accessor ref-index :initarg :index)))
|
|
|
|
(defmethod print-object ((object reference-variable) stream)
|
|
(print-unreadable-object (object stream :type t)
|
|
(format stream "@~D" (ref-index object))))
|