aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob L. Kreuze2023-05-24 14:35:11 -0400
committerJakob L. Kreuze2023-05-24 14:35:11 -0400
commit52d46d42b9cb6273afcb6f6b548fa4e38d7c911b (patch)
tree2a1277085b802b7b52e7db48f16f8d475d2536db
parent4f02ae306d19d6404c8ab00eec31c0da4008e9d7 (diff)
Update `collapse-constraints'
-rw-r--r--compiler/main.scm2
-rw-r--r--compiler/types.scm9
2 files changed, 7 insertions, 4 deletions
diff --git a/compiler/main.scm b/compiler/main.scm
index 44937a8..0815a1d 100644
--- a/compiler/main.scm
+++ b/compiler/main.scm
@@ -55,8 +55,8 @@ of `(program-arguments)'."
(policy (compile-object-literal policy))
(policy (compile-constraints policy))
(policy (compile-funcall policy))
+ (policy (compile-reference policy))
;; (policy (extract-identifiers policy))
- ;; (policy (compile-reference policy))
;; (policy (compile-bool-to-prop policy))
(policy (compile-local-references policy))
)
diff --git a/compiler/types.scm b/compiler/types.scm
index a9d7bc8..9fc3257 100644
--- a/compiler/types.scm
+++ b/compiler/types.scm
@@ -242,6 +242,8 @@ identifier."
(lambda () (write `(,@breadcrumb ,identifier))))
(* 1024 1024)))))
+(define any-type '(null bool number string array object))
+
(define (collapse-constraints scope)
"Return all constraints in SCOPE
@@ -249,10 +251,11 @@ This is independent of context, which is okay, because the identifiers in the
resulting list of constraints are canonicalized such that they are unique and
can be associated with identifiers as they appear in the AST programmatically."
(flat-map (lambda (grouping)
- (let ((_breadcrumb (first grouping))
+ (let ((breadcrumb (first grouping))
(identifiers (drop grouping 1)))
- (flat-map (lambda (identifier-and-constraints)
- (drop identifier-and-constraints 1))
+ (flat-map (lambda (local)
+ `((membero ,(canonicalize (inner local) breadcrumb) ,any-type)
+ ,@(constraints local)))
identifiers)))
(hash-table->alist (inner scope))))

© 2015 - 2026 Jakob L. Kreuze