Skip to content

Commit

Permalink
Add -target js, current-compilation-target, compilation-target?`
Browse files Browse the repository at this point in the history
  • Loading branch information
drewc committed Dec 8, 2024
1 parent 040e458 commit f1723ee
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
7 changes: 1 addition & 6 deletions src/gerbil/compiler/driver.ss
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ namespace: gxc
"base"
"compile"
"optimize")
(export compile-module compile-exe
current-compilation-target
compilation-target?)
(export compile-module compile-exe)

(extern namespace: #f gerbil-path) ;; needed until bootstrap re-generated

Expand All @@ -21,9 +19,6 @@ namespace: gxc
(def default-gerbil-gcc "gcc")
(def default-gerbil-ar "ar")

(def current-compilation-target (make-parameter #f))
(defrule (compilation-target? sym) (eq? (current-compilation-target) 'sym))

(def +driver-mutex+ (make-mutex 'compiler/driver))
(defrules with-driver-mutex ()
((_ expr)
Expand Down
1 change: 1 addition & 0 deletions src/gerbil/core/expander.ss
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ package: gerbil/core
current-expander-path
current-expander-phi
current-expander-compiling?
current-compilation-target?
current-module-reader-path
current-module-reader-args
local-context? top-context? module-context? prelude-context?
Expand Down
5 changes: 4 additions & 1 deletion src/gerbil/core/sugar.ss
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,10 @@ package: gerbil/core
((_ message detail ...)
(stx-string? #'message)
(apply raise-syntax-error #f (stx-e #'message) stx
(syntax->list #'(detail ...)))))))
(syntax->list #'(detail ...))))))

(defrules compilation-target? ()
((_ sym) (eq? (gx#current-compilation-target) 'sym))))

(module Sugar-2
(import Sugar-1 (phi: +1 Sugar-1))
Expand Down
3 changes: 3 additions & 0 deletions src/gerbil/expander/core.ss
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ namespace: gx
(def current-expander-compiling?
(make-parameter #f))

(def current-compilation-target
(make-parameter #f))

;; expander context
(defstruct expander-context (id table)
constructor: :init!
Expand Down

0 comments on commit f1723ee

Please sign in to comment.