~sandy-dunlop/wildcatcobol/dev

« back to all changes in this revision

Viewing changes to src/Wildcat.Cobol.Compiler/ILGenerator/Invoke.cs

  • Committer: Sandy Dunlop
  • Date: 2007-10-17 19:52:18 UTC
  • Revision ID: sandy.dunlop@gmail.com-20071017195218-q1hjcms4vv9wdqtr
Fixing a bug in the code for getting .NET methods form assemblies, and adding objects.cbl - a program that demonstrates the .NET integration

Show diffs side-by-side

added added

removed removed

Lines of Context:
157
157
            PropertyInfo matchingProperty = null;
158
158
            MethodInfo bestMatchingMethod = null;
159
159
                string theMethod = invoke.Method.Value;
160
 
//              Console.WriteLine("The class is "+theClass);
161
 
//              Console.WriteLine("CILAssemblyName = "+classDef.CILAssemblyName);
162
 
//              Console.WriteLine("type = "+type);
163
160
 
164
161
                        Type[] types = new Type[sourceTypes.Count];
165
162
                        for(int i =0;i<sourceTypes.Count;i++)
169
166
                        MethodInfo mi = type.GetMethod(theMethod,types);
170
167
                        if (mi==null)
171
168
                        {
172
 
                                Console.WriteLine("GetMethod FAILED");
173
 
                                //TODO: Throw exception
174
169
                        }else{
175
 
                                //Console.WriteLine("Match: "+mi);
176
170
                                bestMatchingMethod = mi;
177
171
                        }
178
172
 
179
 
 
180
173
            if (invoke.Returning != null)
181
174
            {
182
175
                //Need a pointer to this for storing the result
192
185
                {
193
186
                        //Console.WriteLine("Property: "+prop.Name);
194
187
                    if (prop.Name == theMethod)
195
 
                    {
 
188
                    {
196
189
                        matchingProperty = prop;
197
190
                    }
198
191
                }
207
200
                    r+="        ";
208
201
                    r += ILAddress(5);
209
202
                    string returnType = ILType(matchingProperty.PropertyType.ToString());
210
 
                    r += "call " + returnType + " ['" + theAssembly + "]" + type + "::get_" + theMethod + "()";
 
203
                    r += "call " + returnType + " [" + theAssembly + "]" + type + "::get_" + theMethod + "()";
211
204
                    r += "\n";
212
205
                }
213
206
                else