diff options
author | Eduardo Julian | 2017-03-28 20:52:32 -0400 |
---|---|---|
committer | Eduardo Julian | 2017-03-28 20:52:32 -0400 |
commit | 45100e32862d68639392b7863e5fc2d2d625721b (patch) | |
tree | 782e4ef77eedea6c15895931918ebe1bdf712fa1 /stdlib/source | |
parent | 27a2db0b345f9980ebc23e61a312637a0196a28f (diff) |
- Forgot commit the change about ["jvm" "try"] for lux/host.jvm.lux
Diffstat (limited to 'stdlib/source')
-rw-r--r-- | stdlib/source/lux.lux | 47 | ||||
-rw-r--r-- | stdlib/source/lux/host.jvm.lux | 27 |
2 files changed, 28 insertions, 46 deletions
diff --git a/stdlib/source/lux.lux b/stdlib/source/lux.lux index 7ae8c2847..fc606bc36 100644 --- a/stdlib/source/lux.lux +++ b/stdlib/source/lux.lux @@ -603,7 +603,6 @@ ## #expected (Maybe Type) ## #seed Nat ## #scope-type-vars (List Nat) -## #catching (List Text) ## #host Void}) (_lux_def Compiler (#NamedT ["lux" "Compiler"] @@ -627,10 +626,7 @@ (#ProdT ## scope-type-vars (#AppT List Nat) ## "lux;host" - (#ProdT ## catching - (#AppT List Text) - ## "lux;host" - Void))))))))))) + Void)))))))))) (#Cons [["lux" "tags"] (#ListA (#Cons (#TextA "info") (#Cons (#TextA "source") (#Cons (#TextA "cursor") @@ -640,9 +636,8 @@ (#Cons (#TextA "expected") (#Cons (#TextA "seed") (#Cons (#TextA "scope-type-vars") - (#Cons (#TextA "catching") - (#Cons (#TextA "host") - #Nil))))))))))))] + (#Cons (#TextA "host") + #Nil)))))))))))] (#Cons [["lux" "doc"] (#TextA "Represents the state of the Lux compiler during a run. It is provided to macros during their invocation, so they can access compiler data. @@ -1710,7 +1705,7 @@ {#info info #source source #modules modules #scopes scopes #type-vars types #host host #seed seed #expected expected #cursor cursor - #scope-type-vars scope-type-vars #catching _} state] + #scope-type-vars scope-type-vars} state] (_lux_case (get module modules) (#Some {#module-hash _ #module-aliases _ #defs defs #imports _ #tags tags #types types #module-anns _ #module-state _}) (_lux_case (get name defs) @@ -1869,7 +1864,7 @@ {#info info #source source #modules modules #scopes scopes #type-vars types #host host #seed seed #expected expected #cursor cursor - #scope-type-vars scope-type-vars #catching _} + #scope-type-vars scope-type-vars} (_lux_case (reverse scopes) (#Cons {#name (#;Cons module-name #Nil) #inner-closures _ #locals _ #closure _} _) (#Right [state module-name]) @@ -2214,6 +2209,16 @@ [Real r.% ["real" "%"] "Real remainder."] ) +(do-template [<type> <name> <op> <doc>] + [(def:''' #export (<name> param subject) + (list [["lux" "doc"] (#TextA <doc>)]) + (-> Nat <type> <type>) + (_lux_proc <op> [subject param]))] + + [ Deg d.scale [ "deg" "scale"] "Deg(ree) scale."] + [ Deg d.reciprocal [ "deg" "reciprocal"] "Deg(ree) reciprocal."] + ) + (do-template [<name> <type> <test> <doc>] [(def:''' #export (<name> left right) (list [["lux" "doc"] (#TextA <doc>)]) @@ -2304,7 +2309,7 @@ #scopes scopes #type-vars types #host host #seed seed #expected expected #cursor cursor - #scope-type-vars scope-type-vars #catching _} + #scope-type-vars scope-type-vars} (#Right state (find-macro' modules current-module module name))))))) (def:''' (macro? ident) @@ -2559,12 +2564,12 @@ #scopes scopes #type-vars types #host host #seed seed #expected expected #cursor cursor - #scope-type-vars scope-type-vars #catching catching} + #scope-type-vars scope-type-vars} (#Right {#info info #source source #modules modules #scopes scopes #type-vars types #host host #seed (n.+ +1 seed) #expected expected #cursor cursor - #scope-type-vars scope-type-vars #catching catching} + #scope-type-vars scope-type-vars} (symbol$ ["" ($_ Text/append "__gensym__" prefix (Nat/encode seed))])))) (macro:' #export (Rec tokens) @@ -3428,7 +3433,7 @@ (let [{#info info #source source #modules modules #scopes scopes #type-vars types #host host #seed seed #expected expected #cursor cursor - #scope-type-vars scope-type-vars #catching _} state] + #scope-type-vars scope-type-vars} state] (case (get name modules) (#Some module) (#Right state module) @@ -3491,7 +3496,7 @@ (let [{#info info #source source #modules modules #scopes scopes #type-vars types #host host #seed seed #expected expected #cursor cursor - #scope-type-vars scope-type-vars #catching _} state] + #scope-type-vars scope-type-vars} state] (case expected (#Some type) (#Right state type) @@ -4015,7 +4020,7 @@ {#info info #source source #modules modules #scopes scopes #type-vars types #host host #seed seed #expected expected #cursor cursor - #scope-type-vars scope-type-vars #catching _} + #scope-type-vars scope-type-vars} modules)] (case (get module modules) (#Some =module) @@ -4070,7 +4075,7 @@ {#info info #source source #modules modules #scopes scopes #type-vars types #host host #seed seed #expected expected #cursor cursor - #scope-type-vars scope-type-vars #catching _} + #scope-type-vars scope-type-vars} (find (: (-> Scope (Maybe Type)) (lambda [env] (case env @@ -4090,7 +4095,7 @@ {#info info #source source #modules modules #scopes scopes #type-vars types #host host #seed seed #expected expected #cursor cursor - #scope-type-vars scope-type-vars #catching _} state] + #scope-type-vars scope-type-vars} state] (case (get v-prefix modules) #None #None @@ -4109,7 +4114,7 @@ {#info info #source source #modules modules #scopes scopes #type-vars types #host host #seed seed #expected expected #cursor cursor - #scope-type-vars scope-type-vars #catching _} state] + #scope-type-vars scope-type-vars} state] (case (get v-prefix modules) #None (#Left (Text/append "Unknown definition: " (Ident/encode name))) @@ -5441,7 +5446,7 @@ {#info info #source source #modules modules #scopes scopes #type-vars types #host host #seed seed #expected expected #cursor cursor - #scope-type-vars scope-type-vars #catching _} + #scope-type-vars scope-type-vars} (#Right state scope-type-vars) )) @@ -5544,7 +5549,7 @@ (let [{#;info info #;source source #;modules modules #;scopes scopes #;type-vars types #;host host #;seed seed #;expected expected #;cursor cursor - #;scope-type-vars scope-type-vars #catching _} state] + #;scope-type-vars scope-type-vars} state] (#;Right [state cursor])))) (macro: #export (with-cursor tokens) diff --git a/stdlib/source/lux/host.jvm.lux b/stdlib/source/lux/host.jvm.lux index 41d567165..002208fd2 100644 --- a/stdlib/source/lux/host.jvm.lux +++ b/stdlib/source/lux/host.jvm.lux @@ -352,28 +352,6 @@ class-params)] (` (host (~ (ast;symbol ["" class-name])) [(~@ =params)])))) -(def: (stack-trace->text trace) - (-> StackTrace Text) - (let [size (_lux_proc ["jvm" "arraylength"] [trace]) - idxs (list;n.range +0 (n.dec size))] - (|> idxs - (map (: (-> Nat Text) - (lambda [idx] - (_lux_proc ["jvm" "invokevirtual:java.lang.Object:toString:"] - [(_lux_proc ["jvm" "aaload"] [trace idx])])))) - (text;join-with "\n") - ))) - -(def: (get-stack-trace t) - (-> (host java.lang.Throwable) StackTrace) - (_lux_proc ["jvm" "invokevirtual:java.lang.Throwable:getStackTrace:"] [t])) - -(def: #hidden (throwable->text t) - (All [a] (-> (host java.lang.Throwable) (Either Text a))) - (#;Left (format (_lux_proc ["jvm" "invokevirtual:java.lang.Object:toString:"] [t]) - "\n" - (|> t get-stack-trace stack-trace->text)))) - (def: empty-imports ClassImports (list)) @@ -1497,9 +1475,8 @@ "If it succeeds, you get (#;Right result)." "If it fails, you get (#;Left error+stack-traces-as-text)." (try (risky-computation input)))} - (wrap (list (`' (_lux_proc ["jvm" "try"] - [(#;Right (~ expr)) - ;;throwable->text]))))) + (with-gensyms [g!_] + (wrap (list (`' (_lux_proc ["lux" "try"] [(lambda [(~ g!_)] (~ expr))])))))) (syntax: #export (instance? [#let [imports (class-imports *compiler*)]] [class (generic-type^ imports (list))] |