diff options
author | Eduardo Julian | 2017-12-04 19:46:36 -0400 |
---|---|---|
committer | Eduardo Julian | 2017-12-04 19:46:36 -0400 |
commit | 077e8286b1168909d702ae0c28a0d2941c956f15 (patch) | |
tree | 29b18553df8fac35ecb377813b66b67a8bdebddd /stdlib/source/lux/host.jvm.lux | |
parent | 0b946aa762f777682c53c6171b4797f8869204bb (diff) |
- No longer deleting type-vars in luxc, to better match it with the type-checking in new-luxc.
- Fixed some minor bugs and inconsistencies.
Diffstat (limited to 'stdlib/source/lux/host.jvm.lux')
-rw-r--r-- | stdlib/source/lux/host.jvm.lux | 142 |
1 files changed, 71 insertions, 71 deletions
diff --git a/stdlib/source/lux/host.jvm.lux b/stdlib/source/lux/host.jvm.lux index dbbc26fb8..ba556458a 100644 --- a/stdlib/source/lux/host.jvm.lux +++ b/stdlib/source/lux/host.jvm.lux @@ -77,7 +77,7 @@ (#GenericArray GenericType) (#GenericWildcard (Maybe [BoundKind GenericType]))) -(type: TypeParam +(type: Type-Paramameter [Text (List GenericType)]) (type: Primitive-Mode @@ -100,13 +100,13 @@ #AbstractIM #DefaultIM) -(type: ClassKind +(type: Class-Kind #Class #Interface) -(type: ClassDecl +(type: Class-Declaration {#class-name Text - #class-params (List TypeParam)}) + #class-params (List Type-Paramameter)}) (type: StackFrame (primitive "java/lang/StackTraceElement")) (type: StackTrace (Array StackFrame)) @@ -122,7 +122,7 @@ {#ann-name Text #ann-params (List AnnotationParam)}) -(type: MemberDecl +(type: Member-Declaration {#member-name Text #member-privacy PrivacyModifier #member-anns (List Annotation)}) @@ -132,7 +132,7 @@ (#VariableField StateModifier GenericType)) (type: MethodDecl - {#method-tvars (List TypeParam) + {#method-tvars (List Type-Paramameter) #method-inputs (List GenericType) #method-output GenericType #method-exs (List GenericType)}) @@ -144,38 +144,38 @@ (type: ConstructorArg [GenericType Code]) -(type: MethodDef +(type: Method-Definition (#ConstructorMethod [Bool - (List TypeParam) + (List Type-Paramameter) (List ArgDecl) (List ConstructorArg) Code (List GenericType)]) (#VirtualMethod [Bool Bool - (List TypeParam) + (List Type-Paramameter) (List ArgDecl) GenericType Code (List GenericType)]) (#OverridenMethod [Bool - ClassDecl - (List TypeParam) + Class-Declaration + (List Type-Paramameter) (List ArgDecl) GenericType Code (List GenericType)]) (#StaticMethod [Bool - (List TypeParam) + (List Type-Paramameter) (List ArgDecl) GenericType Code (List GenericType)]) - (#AbstractMethod [(List TypeParam) + (#AbstractMethod [(List Type-Paramameter) (List ArgDecl) GenericType (List GenericType)]) - (#NativeMethod [(List TypeParam) + (#NativeMethod [(List Type-Paramameter) (List ArgDecl) GenericType (List GenericType)])) @@ -192,7 +192,7 @@ {#import-member-mode Primitive-Mode #import-member-alias Text #import-member-kind ImportMethodKind - #import-member-tvars (List TypeParam) + #import-member-tvars (List Type-Paramameter) #import-member-args (List [Bool GenericType]) #import-member-maybe? Bool #import-member-try? Bool @@ -213,7 +213,7 @@ #import-field-setter? Bool #import-field-type GenericType}) -(type: ImportMemberDecl +(type: Import-Member-Declaration (#EnumDecl (List Text)) (#ConstructorDecl [ImportMethodCommons ImportConstructorDecl]) (#MethodDecl [ImportMethodCommons ImportMethodDecl]) @@ -275,8 +275,8 @@ (def: (generic-class->type' mode type-params in-array? name+params class->type') - (-> Primitive-Mode (List TypeParam) Bool [Text (List GenericType)] - (-> Primitive-Mode (List TypeParam) Bool GenericType Code) + (-> Primitive-Mode (List Type-Paramameter) Bool [Text (List GenericType)] + (-> Primitive-Mode (List Type-Paramameter) Bool GenericType Code) Code) (case [name+params mode in-array?] (^multi [[prim #.Nil] #ManualPrM false] @@ -293,7 +293,7 @@ (` (primitive (~ (code.text name)) [(~+ =params)]))))) (def: (class->type' mode type-params in-array? class) - (-> Primitive-Mode (List TypeParam) Bool GenericType Code) + (-> Primitive-Mode (List Type-Paramameter) Bool GenericType Code) (case class (#GenericTypeVar name) (case (list.find (function [[pname pbounds]] @@ -322,16 +322,16 @@ )) (def: (class->type mode type-params class) - (-> Primitive-Mode (List TypeParam) GenericType Code) + (-> Primitive-Mode (List Type-Paramameter) GenericType Code) (class->type' mode type-params false class)) (def: (type-param-type$ [name bounds]) - (-> TypeParam Code) + (-> Type-Paramameter Code) (code.symbol ["" name])) (def: (class-decl-type$ (^slots [#class-name #class-params])) - (-> ClassDecl Code) - (let [=params (list/map (: (-> TypeParam Code) + (-> Class-Declaration Code) + (let [=params (list/map (: (-> Type-Paramameter Code) (function [[pname pbounds]] (case pbounds #.Nil @@ -363,8 +363,8 @@ (: (Meta Class-Imports) (do Monad<Meta> [current-module macro.current-module-name - defs (macro.defs current-module)] - (wrap (list/fold (: (-> [Text Def] Class-Imports Class-Imports) + definitions (macro.definitions current-module)] + (wrap (list/fold (: (-> [Text Definition] Class-Imports Class-Imports) (function [[short-name [_ meta _]] imports] (case (macro.get-text-ann (ident-for #..jvm-class) meta) (#.Some full-class-name) @@ -373,7 +373,7 @@ _ imports))) empty-imports - defs))))) + definitions))))) (#.Left _) (list) (#.Right imports) imports)) @@ -469,7 +469,7 @@ (def: type-var-class Text "java.lang.Object") (def: (simple-class$ env class) - (-> (List TypeParam) GenericType Text) + (-> (List Type-Paramameter) GenericType Text) (case class (#GenericTypeVar name) (case (list.find (function [[pname pbounds]] @@ -563,7 +563,7 @@ )) (def: (field->parser class-name [[field-name _ _] field]) - (-> Text [MemberDecl FieldDecl] (Syntax Code)) + (-> Text [Member-Declaration FieldDecl] (Syntax Code)) (case field (#ConstantField _) (make-get-const-parser class-name field-name) @@ -573,7 +573,7 @@ (make-put-var-parser class-name field-name)))) (def: (make-constructor-parser params class-name arg-decls) - (-> (List TypeParam) Text (List ArgDecl) (Syntax Code)) + (-> (List Type-Paramameter) Text (List ArgDecl) (Syntax Code)) (do p.Monad<Parser> [[_ args] (: (Syntax [Unit (List Code)]) (s.form ($_ p.seq (s.this (' ::new!)) (s.tuple (p.exactly (list.size arg-decls) s.any))))) @@ -582,7 +582,7 @@ (~+ args)))))) (def: (make-static-method-parser params class-name method-name arg-decls) - (-> (List TypeParam) Text Text (List ArgDecl) (Syntax Code)) + (-> (List Type-Paramameter) Text Text (List ArgDecl) (Syntax Code)) (do p.Monad<Parser> [#let [dotted-name (format "::" method-name "!")] [_ args] (: (Syntax [Unit (List Code)]) @@ -593,7 +593,7 @@ (do-template [<name> <jvm-op>] [(def: (<name> params class-name method-name arg-decls) - (-> (List TypeParam) Text Text (List ArgDecl) (Syntax Code)) + (-> (List Type-Paramameter) Text Text (List ArgDecl) (Syntax Code)) (do p.Monad<Parser> [#let [dotted-name (format "::" method-name "!")] [_ args] (: (Syntax [Unit (List Code)]) @@ -607,7 +607,7 @@ ) (def: (method->parser params class-name [[method-name _ _] meth-def]) - (-> (List TypeParam) Text [MemberDecl MethodDef] (Syntax Code)) + (-> (List Type-Paramameter) Text [Member-Declaration Method-Definition] (Syntax Code)) (case meth-def (#ConstructorMethod strict? type-vars args constructor-args return-expr exs) (make-constructor-parser params class-name args) @@ -659,7 +659,7 @@ (not (text.contains? "." name)))) (def: (generic-type^ imports type-vars) - (-> Class-Imports (List TypeParam) (Syntax GenericType)) + (-> Class-Imports (List Type-Paramameter) (Syntax GenericType)) ($_ p.either (do p.Monad<Parser> [_ (s.this (' ?))] @@ -703,7 +703,7 @@ )) (def: (type-param^ imports) - (-> Class-Imports (Syntax TypeParam)) + (-> Class-Imports (Syntax Type-Paramameter)) (p.either (do p.Monad<Parser> [param-name s.local-symbol] (wrap [param-name (list)])) @@ -714,11 +714,11 @@ (wrap [param-name bounds]))))) (def: (type-params^ imports) - (-> Class-Imports (Syntax (List TypeParam))) + (-> Class-Imports (Syntax (List Type-Paramameter))) (s.tuple (p.some (type-param^ imports)))) (def: (class-decl^ imports) - (-> Class-Imports (Syntax ClassDecl)) + (-> Class-Imports (Syntax Class-Declaration)) (p.either (do p.Monad<Parser> [name (full-class-name^ imports) _ (assert-no-periods name)] @@ -731,7 +731,7 @@ )) (def: (super-class-decl^ imports type-vars) - (-> Class-Imports (List TypeParam) (Syntax Super-Class-Decl)) + (-> Class-Imports (List Type-Paramameter) (Syntax Super-Class-Decl)) (p.either (do p.Monad<Parser> [name (full-class-name^ imports) _ (assert-no-periods name)] @@ -767,19 +767,19 @@ (wrap (maybe.default (list) anns??)))) (def: (throws-decl'^ imports type-vars) - (-> Class-Imports (List TypeParam) (Syntax (List GenericType))) + (-> Class-Imports (List Type-Paramameter) (Syntax (List GenericType))) (do p.Monad<Parser> [_ (s.this (' #throws))] (s.tuple (p.some (generic-type^ imports type-vars))))) (def: (throws-decl^ imports type-vars) - (-> Class-Imports (List TypeParam) (Syntax (List GenericType))) + (-> Class-Imports (List Type-Paramameter) (Syntax (List GenericType))) (do p.Monad<Parser> [exs? (p.maybe (throws-decl'^ imports type-vars))] (wrap (maybe.default (list) exs?)))) (def: (method-decl^ imports type-vars) - (-> Class-Imports (List TypeParam) (Syntax [MemberDecl MethodDecl])) + (-> Class-Imports (List Type-Paramameter) (Syntax [Member-Declaration MethodDecl])) (s.form (do p.Monad<Parser> [tvars (p.default (list) (type-params^ imports)) name s.local-symbol @@ -800,7 +800,7 @@ (:: p.Monad<Parser> wrap []))) (def: (field-decl^ imports type-vars) - (-> Class-Imports (List TypeParam) (Syntax [MemberDecl FieldDecl])) + (-> Class-Imports (List Type-Paramameter) (Syntax [Member-Declaration FieldDecl])) (p.either (s.form (do p.Monad<Parser> [_ (s.this (' #const)) name s.local-symbol @@ -817,24 +817,24 @@ (wrap [[name pm anns] (#VariableField [sm type])]))))) (def: (arg-decl^ imports type-vars) - (-> Class-Imports (List TypeParam) (Syntax ArgDecl)) + (-> Class-Imports (List Type-Paramameter) (Syntax ArgDecl)) (s.tuple (p.seq s.local-symbol (generic-type^ imports type-vars)))) (def: (arg-decls^ imports type-vars) - (-> Class-Imports (List TypeParam) (Syntax (List ArgDecl))) + (-> Class-Imports (List Type-Paramameter) (Syntax (List ArgDecl))) (p.some (arg-decl^ imports type-vars))) (def: (constructor-arg^ imports type-vars) - (-> Class-Imports (List TypeParam) (Syntax ConstructorArg)) + (-> Class-Imports (List Type-Paramameter) (Syntax ConstructorArg)) (s.tuple (p.seq (generic-type^ imports type-vars) s.any))) (def: (constructor-args^ imports type-vars) - (-> Class-Imports (List TypeParam) (Syntax (List ConstructorArg))) + (-> Class-Imports (List Type-Paramameter) (Syntax (List ConstructorArg))) (s.tuple (p.some (constructor-arg^ imports type-vars)))) (def: (constructor-method^ imports class-vars) - (-> Class-Imports (List TypeParam) (Syntax [MemberDecl MethodDef])) + (-> Class-Imports (List Type-Paramameter) (Syntax [Member-Declaration Method-Definition])) (s.form (do p.Monad<Parser> [pm privacy-modifier^ strict-fp? (s.this? (' #strict)) @@ -852,7 +852,7 @@ (#ConstructorMethod strict-fp? method-vars arg-decls constructor-args body exs)])))) (def: (virtual-method-def^ imports class-vars) - (-> Class-Imports (List TypeParam) (Syntax [MemberDecl MethodDef])) + (-> Class-Imports (List Type-Paramameter) (Syntax [Member-Declaration Method-Definition])) (s.form (do p.Monad<Parser> [pm privacy-modifier^ strict-fp? (s.this? (' #strict)) @@ -871,7 +871,7 @@ (#VirtualMethod final? strict-fp? method-vars arg-decls return-type body exs)])))) (def: (overriden-method-def^ imports) - (-> Class-Imports (Syntax [MemberDecl MethodDef])) + (-> Class-Imports (Syntax [Member-Declaration Method-Definition])) (s.form (do p.Monad<Parser> [strict-fp? (s.this? (' #strict)) owner-class (class-decl^ imports) @@ -889,7 +889,7 @@ (#OverridenMethod strict-fp? owner-class method-vars arg-decls return-type body exs)])))) (def: (static-method-def^ imports) - (-> Class-Imports (Syntax [MemberDecl MethodDef])) + (-> Class-Imports (Syntax [Member-Declaration Method-Definition])) (s.form (do p.Monad<Parser> [pm privacy-modifier^ strict-fp? (s.this? (' #strict)) @@ -908,7 +908,7 @@ (#StaticMethod strict-fp? method-vars arg-decls return-type body exs)])))) (def: (abstract-method-def^ imports) - (-> Class-Imports (Syntax [MemberDecl MethodDef])) + (-> Class-Imports (Syntax [Member-Declaration Method-Definition])) (s.form (do p.Monad<Parser> [pm privacy-modifier^ _ (s.this (' #abstract)) @@ -925,7 +925,7 @@ (#AbstractMethod method-vars arg-decls return-type exs)])))) (def: (native-method-def^ imports) - (-> Class-Imports (Syntax [MemberDecl MethodDef])) + (-> Class-Imports (Syntax [Member-Declaration Method-Definition])) (s.form (do p.Monad<Parser> [pm privacy-modifier^ _ (s.this (' #native)) @@ -942,7 +942,7 @@ (#NativeMethod method-vars arg-decls return-type exs)])))) (def: (method-def^ imports class-vars) - (-> Class-Imports (List TypeParam) (Syntax [MemberDecl MethodDef])) + (-> Class-Imports (List Type-Paramameter) (Syntax [Member-Declaration Method-Definition])) ($_ p.either (constructor-method^ imports class-vars) (virtual-method-def^ imports class-vars) @@ -956,7 +956,7 @@ (s.form (p.seq s.any s.any))) (def: class-kind^ - (Syntax ClassKind) + (Syntax Class-Kind) (p.either (do p.Monad<Parser> [_ (s.this (' #class))] (wrap #Class)) @@ -972,7 +972,7 @@ s.local-symbol))) (def: (import-member-args^ imports type-vars) - (-> Class-Imports (List TypeParam) (Syntax (List [Bool GenericType]))) + (-> Class-Imports (List Type-Paramameter) (Syntax (List [Bool GenericType]))) (s.tuple (p.some (p.seq (s.this? (' #?)) (generic-type^ imports type-vars))))) (def: import-member-return-flags^ @@ -985,7 +985,7 @@ (s.this (' #auto)))) (def: (import-member-decl^ imports owner-vars) - (-> Class-Imports (List TypeParam) (Syntax ImportMemberDecl)) + (-> Class-Imports (List Type-Paramameter) (Syntax Import-Member-Declaration)) ($_ p.either (s.form (do p.Monad<Parser> [_ (s.this (' #enum)) @@ -1108,11 +1108,11 @@ (format (bound-kind$ bound-kind) (generic-type$ bound)))) (def: (type-param$ [name bounds]) - (-> TypeParam JVM-Code) + (-> Type-Paramameter JVM-Code) (format "(" name " " (spaced (list/map generic-type$ bounds)) ")")) (def: (class-decl$ (^open)) - (-> ClassDecl JVM-Code) + (-> Class-Declaration JVM-Code) (format "(" (sanitize class-name) " " (spaced (list/map type-param$ class-params)) ")")) (def: (super-class-decl$ (^slots [#super-class-name #super-class-params])) @@ -1120,7 +1120,7 @@ (format "(" (sanitize super-class-name) " " (spaced (list/map generic-type$ super-class-params)) ")")) (def: (method-decl$ [[name pm anns] method-decl]) - (-> [MemberDecl MethodDecl] JVM-Code) + (-> [Member-Declaration MethodDecl] JVM-Code) (let [(^slots [#method-tvars #method-inputs #method-output #method-exs]) method-decl] (with-parens (spaced (list name @@ -1139,7 +1139,7 @@ #DefaultSM "default")) (def: (field-decl$ [[name pm anns] field]) - (-> [MemberDecl FieldDecl] JVM-Code) + (-> [Member-Declaration FieldDecl] JVM-Code) (case field (#ConstantField class value) (with-parens @@ -1170,7 +1170,7 @@ (spaced (list (generic-type$ class) (code.to-text term))))) (def: (method-def$ replacer super-class [[name pm anns] method-def]) - (-> (-> Code Code) Super-Class-Decl [MemberDecl MethodDef] JVM-Code) + (-> (-> Code Code) Super-Class-Decl [Member-Declaration Method-Definition] JVM-Code) (case method-def (#ConstructorMethod strict-fp? type-vars arg-decls constructor-args body exs) (with-parens @@ -1469,7 +1469,7 @@ (~ g!obj)))))))) (def: (class-import$ long-name? [full-name params]) - (-> Bool ClassDecl Code) + (-> Bool Class-Declaration Code) (let [def-name (if long-name? full-name (short-class-name full-name)) @@ -1483,7 +1483,7 @@ [(~+ params')])))))) (def: (member-type-vars class-tvars member) - (-> (List TypeParam) ImportMemberDecl (List TypeParam)) + (-> (List Type-Paramameter) Import-Member-Declaration (List Type-Paramameter)) (case member (#ConstructorDecl [commons _]) (list/compose class-tvars (get@ #import-member-tvars commons)) @@ -1500,7 +1500,7 @@ class-tvars)) (def: (member-def-arg-bindings type-params class member) - (-> (List TypeParam) ClassDecl ImportMemberDecl (Meta [(List Code) (List Code) (List Text) (List Code)])) + (-> (List Type-Paramameter) Class-Declaration Import-Member-Declaration (Meta [(List Code) (List Code) (List Text) (List Code)])) (case member (^or (#ConstructorDecl [commons _]) (#MethodDecl [commons _])) (let [(^slots [#import-member-tvars #import-member-args]) commons] @@ -1531,7 +1531,7 @@ (:: Monad<Meta> wrap [(list) (list) (list) (list)]))) (def: (member-def-return mode type-params class member) - (-> Primitive-Mode (List TypeParam) ClassDecl ImportMemberDecl (Meta Code)) + (-> Primitive-Mode (List Type-Paramameter) Class-Declaration Import-Member-Declaration (Meta Code)) (case member (#ConstructorDecl _) (:: Monad<Meta> wrap (class-decl-type$ class)) @@ -1543,7 +1543,7 @@ (macro.fail "Only methods have return values."))) (def: (decorate-return-maybe member [return-type return-term]) - (-> ImportMemberDecl [Code Code] [Code Code]) + (-> Import-Member-Declaration [Code Code] [Code Code]) (case member (^or (#ConstructorDecl [commons _]) (#MethodDecl [commons _])) (if (get@ #import-member-maybe? commons) @@ -1562,7 +1562,7 @@ (do-template [<name> <tag> <type-trans> <term-trans>] [(def: (<name> member [return-type return-term]) - (-> ImportMemberDecl [Code Code] [Code Code]) + (-> Import-Member-Declaration [Code Code] [Code Code]) (case member (^or (#ConstructorDecl [commons _]) (#MethodDecl [commons _])) (if (get@ <tag> commons) @@ -1577,13 +1577,13 @@ ) (def: (free-type-param? [name bounds]) - (-> TypeParam Bool) + (-> Type-Paramameter Bool) (case bounds #.Nil true _ false)) (def: (type-param->type-arg [name _]) - (-> TypeParam Code) + (-> Type-Paramameter Code) (code.symbol ["" name])) (def: (with-mode-output mode output-type body) @@ -1668,7 +1668,7 @@ _ g!input))) (def: (member-def-interop type-params kind class [arg-function-inputs arg-method-inputs arg-classes arg-types] member method-prefix) - (-> (List TypeParam) ClassKind ClassDecl [(List Code) (List Code) (List Text) (List Code)] ImportMemberDecl Text (Meta (List Code))) + (-> (List Type-Paramameter) Class-Kind Class-Declaration [(List Code) (List Code) (List Text) (List Code)] Import-Member-Declaration Text (Meta (List Code))) (let [[full-name class-tvars] class full-name (sanitize full-name) all-params (|> (member-type-vars class-tvars member) @@ -1817,7 +1817,7 @@ ))) (def: (member-import$ type-params long-name? kind class member) - (-> (List TypeParam) Bool ClassKind ClassDecl ImportMemberDecl (Meta (List Code))) + (-> (List Type-Paramameter) Bool Class-Kind Class-Declaration Import-Member-Declaration (Meta (List Code))) (let [[full-name _] class method-prefix (if long-name? full-name @@ -1835,7 +1835,7 @@ (try ("jvm invokestatic:java.lang.Class:forName:java.lang.String" class-name))) (def: (class-kind [class-name _]) - (-> ClassDecl (Meta ClassKind)) + (-> Class-Declaration (Meta Class-Kind)) (let [class-name (sanitize class-name)] (case (load-class class-name) (#.Right class) |