mirror of
https://github.com/Mercury-Language/mercury.git
synced 2025-12-17 06:47:17 +00:00
Estimated hours taken: 18 Branches: main Some fixes to the Java back-end to make it support RTTI better. The aim is to at least be able to *compile* code that makes use of polymorphism (e.g. the Mercury standard library!), although that aim is not yet achieved with this diff. Getting code which actually *uses* the RTTI to work is still a long way off... compiler/rtti.m: compiler/mlds_to_java.m: Fix some bugs in the code to output RTTI type names. compiler/mlds_to_java.m: Output the RTTI definitions. This is needed to avoid errors in code which references them. Handle initializers better; in particular deal with nested initializers properly. Pass the current module name down to output_lval, so that we can module-qualify data names only if they occur in a different module. This is needed to ensure that static data defined in other modules gets module-qualified, but local variables don't. This also required change some places which were incorrectly calling output_fully_qualified_name to instead call output_name. Add comments in the generated output code when generating "java.lang.Object", so that it is clearer what kind of object is involved. Add some special treatment for the types with hand-defined RTTI. java/runtime/*.java: Add some definitions of RTTI types, and some new constructors for the RTTI types that were already defined. These are currently all just stubs.
39 lines
851 B
Java
39 lines
851 B
Java
//
|
|
// Copyright (C) 2001-2003 The University of Melbourne.
|
|
// This file may only be copied under the terms of the GNU Library General
|
|
// Public License - see the file COPYING.LIB in the Mercury distribution.
|
|
//
|
|
|
|
package mercury.runtime;
|
|
|
|
public class TypeInfo_Struct extends PseudoTypeInfo {
|
|
|
|
public TypeCtorInfo_Struct type_ctor;
|
|
public PseudoTypeInfo args[];
|
|
|
|
public TypeInfo_Struct(TypeCtorInfo_Struct tc, PseudoTypeInfo[] as)
|
|
{
|
|
type_ctor = tc;
|
|
args = as;
|
|
}
|
|
|
|
public TypeInfo_Struct(TypeCtorInfo_Struct tc)
|
|
{
|
|
type_ctor = tc;
|
|
args = null;
|
|
}
|
|
|
|
public TypeInfo_Struct(TypeCtorInfo_Struct tc, PseudoTypeInfo a1)
|
|
{
|
|
type_ctor = tc;
|
|
args = new PseudoTypeInfo[] { a1 };
|
|
}
|
|
|
|
public TypeInfo_Struct(TypeCtorInfo_Struct tc, PseudoTypeInfo a1,
|
|
PseudoTypeInfo a2)
|
|
{
|
|
type_ctor = tc;
|
|
args = new PseudoTypeInfo[] { a1, a2 };
|
|
}
|
|
}
|