[m-rev.] diff: fix get_subterm in C#

Peter Ross pro at missioncriticalit.com
Wed Nov 27 03:26:30 AEDT 2002


Hi,


===================================================================


Estimated hours taken: 3
Branches: main

Fix a bug in C# implementation get_subterm.

library/rtti_implementation.m:
	Fix a bug where for the high-level data case we weren't
	indexing into the array after any extra arguments.
	s/TagOffset/ExtraArgs/ as IMHO the new name is more
	descriptive.
	
	


Index: library/rtti_implementation.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/rtti_implementation.m,v
retrieving revision 1.23
diff -u -r1.23 rtti_implementation.m
--- library/rtti_implementation.m	26 Nov 2002 14:40:47 -0000	1.23
+++ library/rtti_implementation.m	26 Nov 2002 16:22:45 -0000
@@ -970,13 +970,14 @@
 
 :- pragma foreign_proc("C#",
 	get_subterm(TypeInfo::in, Term::in, Index::in,
-		TagOffset::in) = (Arg::out), [promise_pure], "
+		ExtraArgs::in) = (Arg::out), [promise_pure], "
+	int i = Index + ExtraArgs;
 	try {
 		// try low level data
-		Arg = ((object[]) Term)[Index + TagOffset];
+		Arg = ((object[]) Term)[i];
 	} catch (System.InvalidCastException) {
 		// try high level data
-		Arg = Term.GetType().GetFields()[Index].GetValue(Term);
+		Arg = Term.GetType().GetFields()[i].GetValue(Term);
 	}
 	TypeInfo_for_T = TypeInfo;
 ").

--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list