aboutsummaryrefslogtreecommitdiffstats
path: root/lib/csc/macros-test.csc
diff options
context:
space:
mode:
authorRose Hogenson <rhogenson@posteo.net>2022-08-23 19:24:26 -0700
committerRose Hogenson <rhogenson@posteo.net>2022-08-23 19:24:26 -0700
commit55a9ceb549911e598be213bdb755272e0f9c4a5c (patch)
treeb84c36f2449203f9d560cb09702af3393b82e652 /lib/csc/macros-test.csc
parent9e3116423f15269e06b2dad558f07f400e02d210 (diff)
downloadchromatopelma-55a9ceb549911e598be213bdb755272e0f9c4a5c.tar.zst
Change argument passing to use lists.
Using vectors is just horribly complicated combined with builtins like apply, or procedures that take a rest parameter. Now we pass all arguments in a list. Hopefully optimization can undo this for known functions in the future.
Diffstat (limited to 'lib/csc/macros-test.csc')
-rw-r--r--lib/csc/macros-test.csc37
1 files changed, 11 insertions, 26 deletions
diff --git a/lib/csc/macros-test.csc b/lib/csc/macros-test.csc
index be573cb..ee4e295 100644
--- a/lib/csc/macros-test.csc
+++ b/lib/csc/macros-test.csc
@@ -242,12 +242,12 @@
(test builtin-syntax-rules-define
(assert-equal
(make-library-define (make-library-ref 'exit 'main)
- (make-lambda '() #f (make-sequence (make-constant #f) (make-call-builtin 'exit (list (make-library-ref 'code 'main))))))
+ (make-lambda (test-ref 'args) (make-sequence (make-constant #f) (make-call-builtin 'exit (list (make-library-ref 'code 'main))))))
(expand-body 'main
'((let-syntax
(define
(syntax-rules ()
- ((define (f . args) body ...)
+ ((define (f) body ...)
(builtin-define f (lambda args body ...)))))
(define (exit)
(call-builtin exit code))))
@@ -259,40 +259,25 @@
(make-lexical-ref sym (gensym)))
- (test builtin-lambda-rest
- (assert-equal
- (make-lambda (list
- (test-ref 'a)
- (test-ref 'b)
- (test-ref 'c))
- (test-ref 'd)
- (make-sequence (make-constant #f) (make-constant 5)))
- (expand-body 'main
- '((lambda
- (a b c . d) (quote 5)))
- builtins-environment)
- transform-ir1))
-
-
(test builtin-lambda-ref
(assert-equal
- (make-lambda (list (test-ref 'x)) #f
- (make-sequence (make-constant #f) (test-ref 'x)))
+ (make-lambda (test-ref 'args)
+ (make-sequence (make-constant #f) (test-ref 'args)))
(expand-body 'main
- '((lambda (x) x))
+ '((lambda args args))
builtins-environment)
transform-ir1))
(test builtin-case-lambda-defines
(assert-equal
- (make-lambda (list (test-ref 'x)) #f
+ (make-lambda (test-ref 'args)
(make-letrec #t '(a b) (list (gensym) (gensym))
(list (make-constant 6)
(test-ref 'a))
(make-sequence (make-constant #f) (make-constant 7))))
(expand-body 'main
- '((lambda (x)
+ '((lambda args
(builtin-define a (quote 6))
(builtin-define b a)
(quote 7)))
@@ -325,13 +310,13 @@
(test builtin-lexical-set
(assert-equal
- (make-lambda (list (test-ref 'x)) #f
+ (make-lambda (test-ref 'args)
(make-sequence
(make-constant #f)
- (make-lexical-set (test-ref 'x) (make-constant 5))))
+ (make-lexical-set (test-ref 'args) (make-constant 5))))
(expand-body 'main
- '((lambda (x)
- (set! x 5)))
+ '((lambda args
+ (set! args 5)))
builtins-environment)
transform-ir1))