1
0
mirror of https://github.com/janet-lang/janet synced 2025-11-19 00:35:11 +00:00

Better printing for complex constants.

Also added stub for checking if constants are valid in IR, but it is
not currently used.
This commit is contained in:
Calvin Rose
2024-09-30 08:14:01 -05:00
parent 731592a80e
commit 6577a18cef
3 changed files with 97 additions and 9 deletions

View File

@@ -11,6 +11,7 @@
(def name-to-type @{})
(def slot-types @{})
(def functions @{})
(def type-fields @{})
(defn get-slot
[&opt new-name]
@@ -105,6 +106,12 @@
(symbol? code)
(named-slot code)
# Array literals
(and (tuple? code) (= :brackets (tuple/type code)))
(do
(assert type-hint (string/format "unknown type for array literal %v" code))
~(,type-hint ,code))
# Compile forms
(and (tuple? code) (= :parens (tuple/type code)))
(do