diff options
Diffstat (limited to 'stdlib/source/lux/tool/compiler/phase/extension/statement.lux')
-rw-r--r-- | stdlib/source/lux/tool/compiler/phase/extension/statement.lux | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/stdlib/source/lux/tool/compiler/phase/extension/statement.lux b/stdlib/source/lux/tool/compiler/phase/extension/statement.lux index f5c52bfc4..030bc5a2b 100644 --- a/stdlib/source/lux/tool/compiler/phase/extension/statement.lux +++ b/stdlib/source/lux/tool/compiler/phase/extension/statement.lux @@ -6,6 +6,7 @@ [io (#+ IO)] ["p" parser]] [data + ["." maybe] ["." error] [text format] @@ -145,15 +146,13 @@ (wrap ////statement.no-requirements)) _ - (///.throw //.invalid-syntax [extension-name])))) + (///.throw //.invalid-syntax [extension-name inputsC+])))) (def: imports (Syntax (List Import)) (|> (s.tuple (p.and s.text s.text)) p.some - s.tuple - (p.after (s.this (' #.imports))) - s.record)) + s.tuple)) (def: def::module Handler @@ -162,13 +161,16 @@ (^ (list annotationsC)) (do ///.monad [[_ annotationsT annotationsV] (evaluate! Code annotationsC) - imports (case (s.run (list (:coerce Code annotationsV)) + #let [annotationsV (:coerce Code annotationsV)] + imports (case (s.run (list (|> annotationsV + (macro.get-ann (name-of #.imports)) + (maybe.default (' [])))) ..imports) (#error.Success imports) (wrap imports) (#error.Failure error) - (///.throw //.invalid-syntax [extension-name])) + (///.throw //.invalid-syntax [extension-name (list annotationsV)])) _ (////statement.lift-analysis (do @ [_ (monad.map @ (function (_ [module alias]) @@ -178,12 +180,12 @@ "" (wrap []) _ (module.alias alias module)))) imports)] - (module.set-annotations (:coerce Code annotationsV))))] + (module.set-annotations annotationsV)))] (wrap {#////statement.imports imports #////statement.referrals (list)})) _ - (///.throw //.invalid-syntax [extension-name])))) + (///.throw //.invalid-syntax [extension-name inputsC+])))) ## TODO: Reify aliasing as a feature of the compiler, instead of ## manifesting it implicitly through definition annotations. @@ -213,7 +215,7 @@ (wrap ////statement.no-requirements)) _ - (///.throw //.invalid-syntax [extension-name])))) + (///.throw //.invalid-syntax [extension-name inputsC+])))) (template [<mame> <type> <scope>] [(def: <mame> @@ -238,7 +240,7 @@ (wrap ////statement.no-requirements)) _ - (///.throw //.invalid-syntax [extension-name]))))] + (///.throw //.invalid-syntax [extension-name inputsC+]))))] [def::analysis ////analysis.Handler ////statement.lift-analysis] [def::synthesis ////synthesis.Handler ////statement.lift-synthesis] @@ -291,7 +293,7 @@ (wrap ////statement.no-requirements)) _ - (///.throw //.invalid-syntax [extension-name])))) + (///.throw //.invalid-syntax [extension-name inputsC+])))) (def: (bundle::def program) (All [anchor expression statement] |