diff options
author | Eduardo Julian | 2018-04-06 08:32:41 -0400 |
---|---|---|
committer | Eduardo Julian | 2018-04-06 08:32:41 -0400 |
commit | ca238f9c89d3156842b0a3d5fe24a5d69b2eedb0 (patch) | |
tree | 50ba106541f2357daf27393df28e8b263f7311e1 /new-luxc/source/luxc/lang/host | |
parent | 84d7e87817cd2c074653b34d028c8fa807febc7f (diff) |
- Adapted new-luxc's code to latest stdlib changes.
Diffstat (limited to '')
-rw-r--r-- | new-luxc/source/luxc/lang/host.jvm.lux | 15 | ||||
-rw-r--r-- | new-luxc/source/luxc/lang/host/js.lux | 4 | ||||
-rw-r--r-- | new-luxc/source/luxc/lang/host/jvm.lux | 8 | ||||
-rw-r--r-- | new-luxc/source/luxc/lang/host/jvm/def.lux | 10 | ||||
-rw-r--r-- | new-luxc/source/luxc/lang/host/jvm/inst.lux | 28 | ||||
-rw-r--r-- | new-luxc/source/luxc/lang/host/lua.lux | 4 | ||||
-rw-r--r-- | new-luxc/source/luxc/lang/host/python.lux | 12 | ||||
-rw-r--r-- | new-luxc/source/luxc/lang/host/ruby.lux | 6 |
8 files changed, 44 insertions, 43 deletions
diff --git a/new-luxc/source/luxc/lang/host.jvm.lux b/new-luxc/source/luxc/lang/host.jvm.lux index 58b79cfa4..b9261f7b0 100644 --- a/new-luxc/source/luxc/lang/host.jvm.lux +++ b/new-luxc/source/luxc/lang/host.jvm.lux @@ -94,7 +94,7 @@ (def: #export (with-anchor anchor expr) (All [a] (-> [Label Register] (Meta a) (Meta a))) - (.function [compiler] + (.function (_ compiler) (let [old (:! commonT.Host (get@ #.host compiler))] (case (expr (set@ #.host (:! Void (set@ #commonT.anchor (#.Some anchor) old)) @@ -110,11 +110,12 @@ (#e.Error error) (#e.Error error))))) -(exception: #export No-Anchor) +(exception: #export (No-Anchor {message Text}) + message) (def: #export anchor (Meta [Label Register]) - (.function [compiler] + (.function (_ compiler) (case (|> compiler (get@ #.host) (:! commonT.Host) (get@ #commonT.anchor)) (#.Some anchor) (#e.Success [compiler @@ -125,7 +126,7 @@ (def: #export (with-context name expr) (All [a] (-> Text (Meta a) (Meta a))) - (.function [compiler] + (.function (_ compiler) (let [old (:! commonT.Host (get@ #.host compiler))] (case (expr (set@ #.host (:! Void (set@ #commonT.context [(&.normalize-name name) +0] old)) @@ -143,7 +144,7 @@ (def: #export (with-sub-context expr) (All [a] (-> (Meta a) (Meta [Text a]))) - (.function [compiler] + (.function (_ compiler) (let [old (:! commonT.Host (get@ #.host compiler)) [old-name old-sub] (get@ #commonT.context old) new-name (format old-name "$" (%i (nat-to-int old-sub)))] @@ -163,7 +164,7 @@ (def: #export context (Meta Text) - (.function [compiler] + (.function (_ compiler) (#e.Success [compiler (|> (get@ #.host compiler) (:! commonT.Host) @@ -173,7 +174,7 @@ (def: #export class-loader (Meta ClassLoader) - (function [compiler] + (function (_ compiler) (#e.Success [compiler (|> compiler (get@ #.host) diff --git a/new-luxc/source/luxc/lang/host/js.lux b/new-luxc/source/luxc/lang/host/js.lux index 41dc0965e..e8f86ebdd 100644 --- a/new-luxc/source/luxc/lang/host/js.lux +++ b/new-luxc/source/luxc/lang/host/js.lux @@ -44,7 +44,7 @@ (def: #export (cond! clauses else!) (-> (List [Expression Statement]) Statement Statement) - (list/fold (.function [[test then!] next!] + (list/fold (.function (_ [test then!] next!) (if! test then! next!)) else! (list.reverse clauses))) @@ -79,7 +79,7 @@ (-> (List [Text Expression]) Expression) (format "({" (|> fields - (list/map (.function [[key val]] + (list/map (.function (_ [key val]) (format key ": " val))) (text.join-with ", ")) "})")) diff --git a/new-luxc/source/luxc/lang/host/jvm.lux b/new-luxc/source/luxc/lang/host/jvm.lux index 67b28b7b0..c76c5144d 100644 --- a/new-luxc/source/luxc/lang/host/jvm.lux +++ b/new-luxc/source/luxc/lang/host/jvm.lux @@ -89,26 +89,26 @@ g!tags+ (list/map code.local-tag options) g!_left (code.local-symbol "_left") g!_right (code.local-symbol "_right") - g!options+ (list/map (function [option] + g!options+ (list/map (function (_ option) (` (def: (~' #export) (~ (code.local-symbol option)) (~ g!type) (|> (~ g!none) (set@ (~ (code.local-tag option)) true))))) options)] (wrap (list& (` (type: (~' #export) (~ g!type) - (~ (code.record (list/map (function [tag] + (~ (code.record (list/map (function (_ tag) [tag (` .Bool)]) g!tags+))))) (` (def: (~' #export) (~ g!none) (~ g!type) - (~ (code.record (list/map (function [tag] + (~ (code.record (list/map (function (_ tag) [tag (` false)]) g!tags+))))) (` (def: (~' #export) ((~ (code.local-symbol ++)) (~ g!_left) (~ g!_right)) (-> (~ g!type) (~ g!type) (~ g!type)) - (~ (code.record (list/map (function [tag] + (~ (code.record (list/map (function (_ tag) [tag (` (or (get@ (~ tag) (~ g!_left)) (get@ (~ tag) (~ g!_right))))]) g!tags+))))) diff --git a/new-luxc/source/luxc/lang/host/jvm/def.lux b/new-luxc/source/luxc/lang/host/jvm/def.lux index 8c73c1086..4cb7aba3e 100644 --- a/new-luxc/source/luxc/lang/host/jvm/def.lux +++ b/new-luxc/source/luxc/lang/host/jvm/def.lux @@ -63,7 +63,7 @@ (def: (string-array values) (-> (List Text) (Array Text)) (let [output (host.array String (list.size values))] - (exec (list/map (function [[idx value]] + (exec (list/map (function (_ [idx value]) (host.array-write idx value output)) (list.enumerate values)) output))) @@ -206,7 +206,7 @@ (def: #export (method visibility config name type then) (-> $.Visibility $.Method-Config Text $.Method $.Inst $.Def) - (function [writer] + (function (_ writer) (let [=method (ClassWriter::visitMethod [($_ i/+ (visibility-flag visibility) (method-flags config)) @@ -224,7 +224,7 @@ (def: #export (abstract-method visibility config name type) (-> $.Visibility $.Method-Config Text $.Method $.Def) - (function [writer] + (function (_ writer) (let [=method (ClassWriter::visitMethod [($_ i/+ (visibility-flag visibility) (method-flags config) @@ -239,7 +239,7 @@ (def: #export (field visibility config name type) (-> $.Visibility $.Field-Config Text $.Type $.Def) - (function [writer] + (function (_ writer) (let [=field (do-to (ClassWriter::visitField [($_ i/+ (visibility-flag visibility) (field-flags config)) @@ -253,7 +253,7 @@ (do-template [<name> <lux-type> <jvm-type> <prepare>] [(def: #export (<name> visibility config name value) (-> $.Visibility $.Field-Config Text <lux-type> $.Def) - (function [writer] + (function (_ writer) (let [=field (do-to (ClassWriter::visitField [($_ i/+ (visibility-flag visibility) (field-flags config)) diff --git a/new-luxc/source/luxc/lang/host/jvm/inst.lux b/new-luxc/source/luxc/lang/host/jvm/inst.lux index 0b1904020..f993f0c48 100644 --- a/new-luxc/source/luxc/lang/host/jvm/inst.lux +++ b/new-luxc/source/luxc/lang/host/jvm/inst.lux @@ -20,7 +20,7 @@ (syntax: (declare [codes (p.many s.local-symbol)]) (|> codes - (list/map (function [code] (` ((~' #static) (~ (code.local-symbol code)) (~' int))))) + (list/map (function (_ code) (` ((~' #static) (~ (code.local-symbol code)) (~' int))))) wrap)) (`` (host.import org/objectweb/asm/Opcodes @@ -113,7 +113,7 @@ ## [Insts] (def: #export make-label (Meta Label) - (function [compiler] + (function (_ compiler) (#e.Success [compiler (Label::new [])]))) (def: #export (with-label action) @@ -123,7 +123,7 @@ (do-template [<name> <type> <prepare>] [(def: #export (<name> value) (-> <type> $.Inst) - (function [visitor] + (function (_ visitor) (do-to visitor (MethodVisitor::visitLdcInsn [(<prepare> value)]))))] @@ -140,14 +140,14 @@ (def: #export NULL $.Inst - (function [visitor] + (function (_ visitor) (do-to visitor (MethodVisitor::visitInsn [(prefix ACONST_NULL)])))) (do-template [<name>] [(def: #export <name> $.Inst - (function [visitor] + (function (_ visitor) (do-to visitor (MethodVisitor::visitInsn [(prefix <name>)]))))] @@ -208,7 +208,7 @@ (do-template [<name>] [(def: #export (<name> register) (-> Nat $.Inst) - (function [visitor] + (function (_ visitor) (do-to visitor (MethodVisitor::visitVarInsn [(prefix <name>) (nat-to-int register)]))))] @@ -219,7 +219,7 @@ (do-template [<name> <inst>] [(def: #export (<name> class field type) (-> Text Text $.Type $.Inst) - (function [visitor] + (function (_ visitor) (do-to visitor (MethodVisitor::visitFieldInsn [<inst> ($t.binary-name class) field ($t.descriptor type)]))))] @@ -233,7 +233,7 @@ (do-template [<name> <inst>] [(def: #export (<name> class) (-> Text $.Inst) - (function [visitor] + (function (_ visitor) (do-to visitor (MethodVisitor::visitTypeInsn [<inst> ($t.binary-name class)]))))] @@ -245,7 +245,7 @@ (def: #export (NEWARRAY type) (-> $.Primitive $.Inst) - (function [visitor] + (function (_ visitor) (do-to visitor (MethodVisitor::visitIntInsn [Opcodes::NEWARRAY (case type #$.Boolean Opcodes::T_BOOLEAN @@ -260,7 +260,7 @@ (do-template [<name> <inst>] [(def: #export (<name> class method-name method-signature interface?) (-> Text Text $.Method Bool $.Inst) - (function [visitor] + (function (_ visitor) (do-to visitor (MethodVisitor::visitMethodInsn [<inst> ($t.binary-name class) method-name ($t.method-descriptor method-signature) interface?]))))] @@ -273,7 +273,7 @@ (do-template [<name>] [(def: #export (<name> @where) (-> $.Label $.Inst) - (function [visitor] + (function (_ visitor) (do-to visitor (MethodVisitor::visitJumpInsn [(prefix <name>) @where]))))] @@ -284,7 +284,7 @@ (def: #export (TABLESWITCH min max default labels) (-> Int Int $.Label (List $.Label) $.Inst) - (function [visitor] + (function (_ visitor) (let [num-labels (list.size labels) labels-array (host.array Label num-labels) _ (loop [idx +0] @@ -299,13 +299,13 @@ (def: #export (try @from @to @handler exception) (-> $.Label $.Label $.Label Text $.Inst) - (function [visitor] + (function (_ visitor) (do-to visitor (MethodVisitor::visitTryCatchBlock [@from @to @handler ($t.binary-name exception)])))) (def: #export (label @label) (-> $.Label $.Inst) - (function [visitor] + (function (_ visitor) (do-to visitor (MethodVisitor::visitLabel [@label])))) diff --git a/new-luxc/source/luxc/lang/host/lua.lux b/new-luxc/source/luxc/lang/host/lua.lux index 943b0377e..8f057bc29 100644 --- a/new-luxc/source/luxc/lang/host/lua.lux +++ b/new-luxc/source/luxc/lang/host/lua.lux @@ -87,7 +87,7 @@ (def: #export (cond! clauses else!) (-> (List [Expression Statement]) Statement Statement) - (list/fold (.function [[test then!] next!] + (list/fold (.function (_ [test then!] next!) (if! test then! next!)) else! (list.reverse clauses))) @@ -139,7 +139,7 @@ (-> (List [Text Expression]) Expression) (format "{" (|> fields - (list/map (.function [[key val]] + (list/map (.function (_ [key val]) (format key " = " val))) (text.join-with ", ")) "}")) diff --git a/new-luxc/source/luxc/lang/host/python.lux b/new-luxc/source/luxc/lang/host/python.lux index 335d418a3..8e42ff0a5 100644 --- a/new-luxc/source/luxc/lang/host/python.lux +++ b/new-luxc/source/luxc/lang/host/python.lux @@ -1,5 +1,5 @@ (.module: - [lux #- not or and list if is] + [lux #- not or and list if] (lux (control pipe) (data [text] text/format @@ -79,7 +79,7 @@ (def: (composite-literal left-delimiter right-delimiter entry-serializer) (All [a] (-> Text Text (-> a Text) (-> (List a) Expression))) - (function [entries] + (function (_ entries) (@abstraction (format "(" left-delimiter (|> entries (list/map entry-serializer) (text.join-with ",")) right-delimiter ")")))) @@ -107,7 +107,7 @@ (def: #export dict (-> (List [Expression Expression]) Expression) - (composite-literal "{" "}" (.function [[k v]] (format (@representation k) " : " (@representation v))))) + (composite-literal "{" "}" (.function (_ [k v]) (format (@representation k) " : " (@representation v))))) (def: #export (apply args func) (-> (List Expression) Expression Expression) @@ -129,7 +129,7 @@ (-> (List Expression) Expression Expression Expression) (@abstraction (format "(" (@representation func) (format "(" (|> args - (list/map (function [arg] (format (@representation arg) ", "))) + (list/map (function (_ arg) (format (@representation arg) ", "))) (text.join-with "")) (<splat> extra) ")") ")")))] @@ -266,7 +266,7 @@ (def: #export (cond! clauses else!) (-> (List [Expression Statement]) Statement Statement) - (list/fold (.function [[test then!] next!] + (list/fold (.function (_ [test then!] next!) (if! test then! next!)) else! (list.reverse clauses))) @@ -310,7 +310,7 @@ (format "try:" (nest body!) (|> excepts - (list/map (function [[classes exception catch!]] + (list/map (function (_ [classes exception catch!]) (format "\n" "except (" (text.join-with "," classes) ") as " (..name exception) ":" (nest catch!)))) diff --git a/new-luxc/source/luxc/lang/host/ruby.lux b/new-luxc/source/luxc/lang/host/ruby.lux index 3f179105d..c2bc6e95f 100644 --- a/new-luxc/source/luxc/lang/host/ruby.lux +++ b/new-luxc/source/luxc/lang/host/ruby.lux @@ -46,7 +46,7 @@ (-> (List [Expression Expression]) Expression) (format "({" (|> kvs - (list/map (.function [[k v]] + (list/map (.function (_ [k v]) (format k " => " v))) (text.join-with ", ")) "})")) @@ -111,7 +111,7 @@ (def: #export (cond! clauses else!) (-> (List [Expression Statement]) Statement Statement) - (list/fold (.function [[test then!] next!] + (list/fold (.function (_ [test then!] next!) (if! test then! next!)) else! (list.reverse clauses))) @@ -141,7 +141,7 @@ (format "begin" "\n" body "\n" (|> rescues - (list/map (function [[ex-classes ex-value ex-handler]] + (list/map (function (_ [ex-classes ex-value ex-handler]) (format "rescue " (text.join-with ", " ex-classes) (case ex-value "" "" |