[m-dev.] diff: MLDS back-end: mlds_to_c.m bug fix for `new_object'
Fergus Henderson
fjh at cs.mu.OZ.AU
Wed Nov 17 05:00:53 AEDT 1999
Estimated hours taken: 0.5
compiler/mlds_to_c.m:
Fix a bug: the code to output `new_object' statements
was outputting a sequence of C statements without braces
around them, not a single statement, which lead to syntax
errors if a `new_object' statement occurred as the `then'
part of an if-then-else. The fix was to just add braces
around them.
Workspace: /d-drive/home/hg/fjh/mercury
Index: compiler/mlds_to_c.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mlds_to_c.m,v
retrieving revision 1.15
diff -u -d -r1.15 mlds_to_c.m
--- compiler/mlds_to_c.m 1999/11/16 16:16:23 1.15
+++ compiler/mlds_to_c.m 1999/11/16 17:59:33
@@ -1255,6 +1255,8 @@
{ NewObject = new_object(Target, MaybeTag, Type, MaybeSize,
MaybeCtorName, Args, ArgTypes) },
mlds_indent(Indent),
+ io__write_string("{\n"),
+ mlds_indent(Indent + 1),
mlds_output_lval(Target),
io__write_string(" = "),
( { MaybeTag = yes(Tag0) } ->
@@ -1287,7 +1289,10 @@
io__write_string(")"),
io__write_string(EndMkword),
io__write_string(";\n"),
- mlds_output_init_args(Args, ArgTypes, Context, 0, Target, Tag, Indent).
+ mlds_output_init_args(Args, ArgTypes, Context, 0, Target, Tag,
+ Indent + 1),
+ mlds_indent(Indent),
+ io__write_string("}\n").
mlds_output_atomic_stmt(Indent, mark_hp(Lval), _) -->
mlds_indent(Indent),
--
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