[m-dev.] for review: The .NET MSIL backend.

Fergus Henderson fjh at cs.mu.OZ.AU
Fri Oct 13 17:41:34 AEDT 2000


On 13-Oct-2000, Tyson Dowd <trd at cs.mu.OZ.AU> wrote:
> +++ mlds_to_il.m
>  :- pred generate_other_decls(mlds_module_name, mlds__defn, list(ilasm__decl)).
>  :- mode generate_other_decls(in, in, out) is det.
>  generate_other_decls(ModuleName, MLDSDefn, Decls) :-
> -	ModuleStructuredName = mlds_module_name_to_structured_name(ModuleName),
> +	ClassName = mlds_module_name_to_class_name(ModuleName),
>  	MLDSDefn = mlds__defn(EntityName, _Context, _DeclFlags, Entity), 
>  	term__type_to_term(MLDSDefn, MLDSDefnTerm),
>  	( EntityName = type(TypeName, _Arity),
> -		list__append(ModuleStructuredName, [TypeName],
> +		list__append(ClassName, [TypeName],
>  			FullClassName),
> +		( 
> +			Entity = mlds__class(ClassDefn) 
> +		->
> +			ClassDefn = mlds__class_defn(ClassType, _Imports, 
> +				_Inherits, _Implements, Defns),
> +			( 
> +				ClassType = mlds__class
> +			->
> +				list__map(defn_to_class_decl, Defns, ILDefns),
> +				make_constructor(FullClassName, ClassDefn, 
> +					ConstructorILDefn),
> +				Decls = [comment_term(MLDSDefnTerm),
> +					class([public], TypeName,
> +					extends_nothing, implements([]),
> +					[ConstructorILDefn | ILDefns])]
> +			; 
> +				Entity = mlds__class(ClassDefn),

That line is not needed -- you already tested that condition above.

>  unaryop_to_il(box(Type), _, Instrs) -->
> -	{ mlds_type_to_ilds_type(Type, ILType) },
> +	{ ILType = mlds_type_to_ilds_type(Type) },
>  	{ already_boxed(ILType) ->
>  		Instrs = node([isinst(ilds__type([], 
> -			class(["mscorlib", "System", "Object"])))])
> +			class([mscorlib_name, "System", "Object"])))])

Something like

			class(il_system_name(["Object"]))])

where `il_system_name' was defined by

		% qualify a name with "[mscorlib]system."
	:- func il_system_name(ilds__structured_name) = ilds__structure_name.
	il_system_name(Name) =
		[il_system_assembly_name, il_system_namespace_name | Name].

	:- func il_system_assembly_name = string.
	il_system_assembly_name = "mscorlib".

	:- func il_system_namespace_name = string.
	il_system_namespace_name = "System".

would be better.

Apart from that, the relative diff looks fine.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list