mescc: Implement unary plus operator.
* module/mescc/compile.scm (ast->type, expr->register, try-expr->number):): Implement unary plus operator.
This commit is contained in:
parent
d96730b892
commit
ab57acfa01
|
@ -209,6 +209,7 @@
|
||||||
((mod ,a ,b) (ast->type a info))
|
((mod ,a ,b) (ast->type a info))
|
||||||
((mul ,a ,b) (ast->type a info))
|
((mul ,a ,b) (ast->type a info))
|
||||||
((not ,a) (ast->type a info))
|
((not ,a) (ast->type a info))
|
||||||
|
((pos ,a) (ast->type a info))
|
||||||
((neg ,a) (ast->type a info))
|
((neg ,a) (ast->type a info))
|
||||||
((eq ,a ,b) (ast->type a info))
|
((eq ,a ,b) (ast->type a info))
|
||||||
((ge ,a ,b) (ast->type a info))
|
((ge ,a ,b) (ast->type a info))
|
||||||
|
@ -1218,6 +1219,9 @@
|
||||||
(info (append-text info (wrap-as (as info 'r-negate)))))
|
(info (append-text info (wrap-as (as info 'r-negate)))))
|
||||||
(append-text info (wrap-as (as info 'test-r))))) ;; hmm, use ast->info?
|
(append-text info (wrap-as (as info 'test-r))))) ;; hmm, use ast->info?
|
||||||
|
|
||||||
|
((pos ,expr)
|
||||||
|
(expr->register expr info))
|
||||||
|
|
||||||
((neg ,expr)
|
((neg ,expr)
|
||||||
(let* ((info (expr->register expr info))
|
(let* ((info (expr->register expr info))
|
||||||
(info (allocate-register info))
|
(info (allocate-register info))
|
||||||
|
@ -1559,6 +1563,8 @@
|
||||||
(pmatch o
|
(pmatch o
|
||||||
((fixed ,a) (cstring->int a))
|
((fixed ,a) (cstring->int a))
|
||||||
((p-expr ,expr) (expr->number info expr))
|
((p-expr ,expr) (expr->number info expr))
|
||||||
|
((pos ,a)
|
||||||
|
(expr->number info a))
|
||||||
((neg ,a)
|
((neg ,a)
|
||||||
(- (expr->number info a)))
|
(- (expr->number info a)))
|
||||||
((add ,a ,b)
|
((add ,a ,b)
|
||||||
|
|
Loading…
Reference in a new issue