aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/target/jvm/reflection.lux
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/lux/target/jvm/reflection.lux')
-rw-r--r--stdlib/source/lux/target/jvm/reflection.lux90
1 files changed, 45 insertions, 45 deletions
diff --git a/stdlib/source/lux/target/jvm/reflection.lux b/stdlib/source/lux/target/jvm/reflection.lux
index 4dfdbc30c..040c277b8 100644
--- a/stdlib/source/lux/target/jvm/reflection.lux
+++ b/stdlib/source/lux/target/jvm/reflection.lux
@@ -102,18 +102,18 @@
(getConstructors [] [(java/lang/reflect/Constructor java/lang/Object)])
(getDeclaredMethods [] [java/lang/reflect/Method])])
-(exception: #export (unknown-class {class External})
+(exception: #export (unknown_class {class External})
(exception.report
["Class" (%.text class)]))
(template [<name>]
- [(exception: #export (<name> {jvm-type java/lang/reflect/Type})
+ [(exception: #export (<name> {jvm_type java/lang/reflect/Type})
(exception.report
- ["Type" (java/lang/reflect/Type::getTypeName jvm-type)]
- ["Class" (|> jvm-type java/lang/Object::getClass java/lang/Object::toString)]))]
+ ["Type" (java/lang/reflect/Type::getTypeName jvm_type)]
+ ["Class" (|> jvm_type java/lang/Object::getClass java/lang/Object::toString)]))]
- [not-a-class]
- [cannot-convert-to-a-lux-type]
+ [not_a_class]
+ [cannot_convert_to_a_lux_type]
)
(def: #export (load name)
@@ -123,7 +123,7 @@
(#try.Success class)
(#try.Failure _)
- (exception.throw ..unknown-class name)))
+ (exception.throw ..unknown_class name)))
(def: #export (sub? super sub)
(-> External External (Try Bit))
@@ -138,12 +138,12 @@
(Try (/.Type Class)))
(<| (case (host.check java/lang/Class reflection)
(#.Some class)
- (let [class-name (|> class
+ (let [class_name (|> class
(:coerce (java/lang/Class java/lang/Object))
java/lang/Class::getName)]
(`` (if (or (~~ (template [<reflection>]
[(text\= (/reflection.reflection <reflection>)
- class-name)]
+ class_name)]
[/reflection.boolean]
[/reflection.byte]
@@ -153,9 +153,9 @@
[/reflection.float]
[/reflection.double]
[/reflection.char]))
- (text.starts-with? /descriptor.array-prefix class-name))
- (exception.throw ..not-a-class reflection)
- (#try.Success (/.class class-name (list))))))
+ (text.starts_with? /descriptor.array_prefix class_name))
+ (exception.throw ..not_a_class reflection)
+ (#try.Success (/.class class_name (list))))))
_)
(case (host.check java/lang/reflect/ParameterizedType reflection)
(#.Some reflection)
@@ -165,7 +165,7 @@
(do {! try.monad}
[paramsT (|> reflection
java/lang/reflect/ParameterizedType::getActualTypeArguments
- array.to-list
+ array.to_list
(monad.map ! parameter))]
(wrap (/.class (|> raw
(:coerce (java/lang/Class java/lang/Object))
@@ -173,10 +173,10 @@
paramsT)))
_
- (exception.throw ..not-a-class raw)))
+ (exception.throw ..not_a_class raw)))
_)
## else
- (exception.throw ..cannot-convert-to-a-lux-type reflection)))
+ (exception.throw ..cannot_convert_to_a_lux_type reflection)))
(def: #export (parameter reflection)
(-> java/lang/reflect/Type (Try (/.Type Parameter)))
@@ -217,12 +217,12 @@
(-> java/lang/reflect/Type (Try (/.Type Value)))
(<| (case (host.check java/lang/Class reflection)
(#.Some reflection)
- (let [class-name (|> reflection
+ (let [class_name (|> reflection
(:coerce (java/lang/Class java/lang/Object))
java/lang/Class::getName)]
(`` (cond (~~ (template [<reflection> <type>]
[(text\= (/reflection.reflection <reflection>)
- class-name)
+ class_name)
(#try.Success <type>)]
[/reflection.boolean /.boolean]
@@ -233,9 +233,9 @@
[/reflection.float /.float]
[/reflection.double /.double]
[/reflection.char /.char]))
- (if (text.starts-with? /descriptor.array-prefix class-name)
- (<t>.run /parser.value (|> class-name //name.internal //name.read))
- (#try.Success (/.class class-name (list)))))))
+ (if (text.starts_with? /descriptor.array_prefix class_name)
+ (<t>.run /parser.value (|> class_name //name.internal //name.read))
+ (#try.Success (/.class class_name (list)))))))
_)
(case (host.check java/lang/reflect/GenericArrayType reflection)
(#.Some reflection)
@@ -249,27 +249,27 @@
(def: #export (return reflection)
(-> java/lang/reflect/Type (Try (/.Type Return)))
- (with-expansions [<else> (as-is (..type reflection))]
+ (with_expansions [<else> (as_is (..type reflection))]
(case (host.check java/lang/Class reflection)
(#.Some class)
- (let [class-name (|> reflection
+ (let [class_name (|> reflection
(:coerce (java/lang/Class java/lang/Object))
java/lang/Class::getName)]
(if (text\= (/reflection.reflection /reflection.void)
- class-name)
+ class_name)
(#try.Success /.void)
<else>))
#.None
<else>)))
-(exception: #export (cannot-correspond {class (java/lang/Class java/lang/Object)}
+(exception: #export (cannot_correspond {class (java/lang/Class java/lang/Object)}
{type Type})
(exception.report
["Class" (java/lang/Object::toString class)]
["Type" (%.type type)]))
-(exception: #export (type-parameter-mismatch {expected Nat}
+(exception: #export (type_parameter_mismatch {expected Nat}
{actual Nat}
{class (java/lang/Class java/lang/Object)}
{type Type})
@@ -279,7 +279,7 @@
["Class" (java/lang/Object::toString class)]
["Type" (%.type type)]))
-(exception: #export (non-jvm-type {type Type})
+(exception: #export (non_jvm_type {type Type})
(exception.report
["Type" (%.type type)]))
@@ -287,21 +287,21 @@
(-> (java/lang/Class java/lang/Object) Type (Try Mapping))
(case type
(#.Primitive name params)
- (let [class-name (java/lang/Class::getName class)
- class-params (array.to-list (java/lang/Class::getTypeParameters class))
- num-class-params (list.size class-params)
- num-type-params (list.size params)]
- (if (text\= class-name name)
- (if (n.= num-class-params num-type-params)
+ (let [class_name (java/lang/Class::getName class)
+ class_params (array.to_list (java/lang/Class::getTypeParameters class))
+ num_class_params (list.size class_params)
+ num_type_params (list.size params)]
+ (if (text\= class_name name)
+ (if (n.= num_class_params num_type_params)
(|> params
(list.zip/2 (list\map (|>> java/lang/reflect/TypeVariable::getName)
- class-params))
+ class_params))
(list\fold (function (_ [name paramT] mapping)
(dictionary.put name paramT mapping))
/lux.fresh)
#try.Success)
- (exception.throw ..type-parameter-mismatch [num-class-params num-type-params class type]))
- (exception.throw ..cannot-correspond [class type])))
+ (exception.throw ..type_parameter_mismatch [num_class_params num_type_params class type]))
+ (exception.throw ..cannot_correspond [class type])))
(#.Named name anonymousT)
(correspond class anonymousT)
@@ -312,12 +312,12 @@
(correspond class outputT)
#.None
- (exception.throw ..non-jvm-type [type]))
+ (exception.throw ..non_jvm_type [type]))
_
- (exception.throw ..non-jvm-type [type])))
+ (exception.throw ..non_jvm_type [type])))
-(exception: #export (mistaken-field-owner {field java/lang/reflect/Field}
+(exception: #export (mistaken_field_owner {field java/lang/reflect/Field}
{owner (java/lang/Class java/lang/Object)}
{target (java/lang/Class java/lang/Object)})
(exception.report
@@ -332,9 +332,9 @@
["Field" (%.text field)]
["Class" (java/lang/Object::toString class)]))]
- [unknown-field]
- [not-a-static-field]
- [not-a-virtual-field]
+ [unknown_field]
+ [not_a_static_field]
+ [not_a_virtual_field]
)
(def: #export (field field target)
@@ -344,10 +344,10 @@
(let [owner (java/lang/reflect/Field::getDeclaringClass field)]
(if (is? owner target)
(#try.Success field)
- (exception.throw ..mistaken-field-owner [field owner target])))
+ (exception.throw ..mistaken_field_owner [field owner target])))
(#try.Failure _)
- (exception.throw ..unknown-field [field target])))
+ (exception.throw ..unknown_field [field target])))
(template [<name> <exception> <then?> <else?>]
[(def: #export (<name> field class)
@@ -362,6 +362,6 @@
(\ ! map (|>> [(java/lang/reflect/Modifier::isFinal modifiers)])))
<else?> (exception.throw <exception> [field class]))))]
- [static-field ..not-a-static-field #1 #0]
- [virtual-field ..not-a-virtual-field #0 #1]
+ [static_field ..not_a_static_field #1 #0]
+ [virtual_field ..not_a_virtual_field #0 #1]
)