type an operator's result without qualifiers
The spelling was the first operand's, so (+ k 1) with k const was a const int and (+ 1 k) was not; a value has no qualifiers either way.
This commit is contained in:
11
infer.scm
11
infer.scm
@@ -39,6 +39,7 @@
|
||||
underlying
|
||||
c-primitive?
|
||||
decay
|
||||
unqualified
|
||||
|
||||
;; The boundary
|
||||
parse-type
|
||||
@@ -151,6 +152,16 @@
|
||||
((fn-type? t) (make-ptr t (list)))
|
||||
(else (resolve type)))))
|
||||
|
||||
;;; TYPE as a value has it: qualifiers belong to an object, not to what
|
||||
;;; is read out of one. `(const int)' -> `int', `(* const char)' as is.
|
||||
(define (unqualified type)
|
||||
(let ((t (resolve type)))
|
||||
(cond ((prim-type? t) (make-prim (prim-name t) (list)))
|
||||
((ptr-type? t) (make-ptr (ptr-target t) (list)))
|
||||
((agg-type? t) (make-agg (agg-kind t) (agg-name t) (agg-spelling t) (list)))
|
||||
((alias-type? t) (make-alias (alias-name t) (alias-expansion t) (list)))
|
||||
(else t))))
|
||||
|
||||
;;; ---------------------------------------------------------------
|
||||
;;; Surface -> IR
|
||||
;;; ---------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user