mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-15 17:33:38 +00:00
Implement RTTI for the Java-backend (incomplete)
Estimated hours taken: 30 Branches: main Implement RTTI for the Java-backend (incomplete) java/runtime/PseudoTypeInfo.java: java/runtime/TypeCtorInfo_Struct.java: java/runtime/TypeInfo_Struct.java: Implement the `unify' operation for these classes. This implementation actually just compares them. library/rtti_implementation.m: Document a bug in notag_functor_arg_type/1 Define the foreign type of `type_layout' as `TypeLayout' in Java. Correct an off-by-one error in type_ctor_and_args/3. Implement deconstruct/8 for TypeCtorRep = enum. Implement the following predicates in Java: get_var_arity_typeinfo_arity/1 get_pti_from_arg_types/2 typeinfo_is_variable/2 get_type_ctor_info/1 get_primary_tag/1 get_remote_secondary_tag/1 ptag_index/2 sectag_locn/1 du_sectag_alternatives/2 type_info_index/2 type_ctor_arity/1 type_ctor_rep/1 type_ctor_module_name/1 type_ctor_name/1 type_ctor_functors/1 type_layout/1 unsafe_cast/1 du_functor_desc/3 du_functor_name/1 du_functor_arity/1 du_functor_arg_type_contains_var/1 du_functor_sectag_locn/1 du_functor_primary/1 du_functor_secondary/1 du_functor_ordinal/1 du_functor_arg_types/1 du_functor_arg_names/1 du_functor_exist_info/1 enum_functor_desc/3 enum_functor_name/1 enum_functor_ordinal/1 notag_functor_desc/3 notag_functor_name/1 notag_functor_arg_type/1 notag_functor_arg_name/1 null/1 null_string/0 unsafe_get_enum_value/1 library/type_desc.m: Implement the following procedures for Java: type_of/1 has_type/1 type_ctor_and_args/3 type_ctor_name_and_arity/4 Implement the Java classes `type_desc_0' and `type_ctor_desc_0'.
This commit is contained in:
@@ -25,4 +25,14 @@ public class PseudoTypeInfo {
|
||||
public int variable_number;
|
||||
public PseudoTypeInfo(int n) { variable_number = n; }
|
||||
protected PseudoTypeInfo() { variable_number = -1; }
|
||||
|
||||
// XXX This should be renamed `equals'
|
||||
public boolean unify(PseudoTypeInfo ti) {
|
||||
if (this.getClass() == TypeInfo_Struct.class &&
|
||||
ti.getClass() == TypeInfo_Struct.class) {
|
||||
return ((TypeInfo_Struct) this).unify(
|
||||
(TypeInfo_Struct) ti);
|
||||
}
|
||||
return variable_number == ti.variable_number;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user