diff options
Diffstat (limited to 'stdlib/source/library/lux/ffi.js.lux')
-rw-r--r-- | stdlib/source/library/lux/ffi.js.lux | 72 |
1 files changed, 44 insertions, 28 deletions
diff --git a/stdlib/source/library/lux/ffi.js.lux b/stdlib/source/library/lux/ffi.js.lux index ddcac1a30..8cae0a976 100644 --- a/stdlib/source/library/lux/ffi.js.lux +++ b/stdlib/source/library/lux/ffi.js.lux @@ -1,26 +1,26 @@ (.using - [library - [lux {"-" Symbol} - ["[0]" meta] - [abstract - [monad {"+" do}]] - [control - ["[0]" io] - ["[0]" maybe] - ["<>" parser ("[1]#[0]" monad) - ["<[0]>" code {"+" Parser}]]] - [data - ["[0]" product] - ["[0]" text - ["%" format]] - [collection - ["[0]" list ("[1]#[0]" functor)]]] - [type - abstract] - [macro {"+" with_symbols} - [syntax {"+" syntax:}] - ["[0]" code] - ["[0]" template]]]]) + [library + [lux {"-" Symbol} + ["[0]" meta] + [abstract + [monad {"+" do}]] + [control + ["[0]" io] + ["[0]" maybe] + ["<>" parser ("[1]#[0]" monad) + ["<[0]>" code {"+" Parser}]]] + [data + ["[0]" product] + ["[0]" text + ["%" format]] + [collection + ["[0]" list ("[1]#[0]" functor)]]] + [type + abstract] + [macro {"+" with_symbols} + [syntax {"+" syntax:}] + ["[0]" code] + ["[0]" template]]]]) (abstract: .public (Object brand) Any) @@ -79,6 +79,13 @@ <code>.local_symbol ..nullable))) +(def: constant_import + (Parser Field) + (<code>.form ($_ <>.and + (<>#in true) + <code>.local_symbol + ..nullable))) + (type: Common_Method (Record [#name Text @@ -177,7 +184,8 @@ (type: Import (Variant {#Class [Class_Declaration Text (List Member)]} - {#Function Static_Method})) + {#Function Static_Method} + {#Constant Field})) (def: class_declaration (Parser Class_Declaration) @@ -188,11 +196,12 @@ (def: import (Parser Import) - (<>.or (<>.and ..class_declaration - (<>.else ["" (list)] - (<code>.tuple (<>.and <code>.text - (<>.some member))))) - (<code>.form ..common_method))) + ($_ <>.or + (<>.and ..class_declaration + (<code>.tuple (<>.and <code>.text + (<>.some member)))) + (<code>.form ..common_method) + ..constant_import)) (def: (with_io with? without) (-> Bit Code Code) @@ -320,6 +329,13 @@ io? try? outputT))) + + {#Constant [_ name :output:]} + (in (list (` (.def: (~ (code.local_symbol name)) + (~ (nullable_type :output:)) + (.:expected + (~ (<| (without_null g!temp :output:) + (` ("js constant" (~ (code.text name))))))))))) ))) (template: .public (type_of object) |