if (mi.Length == 1 && !(mi [0] is MethodBase))
return Expression.ExprClassFromMemberInfo (mi [0]);
-
+
for (int i = 0; i < mi.Length; i++)
if (!(mi [i] is MethodBase)){
rc.Report.Error (-5, "Do not know how to reproduce this case: " +
Expression left, right;
MethodBase method;
ArrayList Arguments;
+
public Binary (Operator oper, Expression left, Expression right)
{
if (left_expr != null || right_expr != null) {
//
// Now we need to form the union of these two sets and
- // then call OverloadResolve
- // on that.
+ // then call OverloadResolve on that.
//
MethodGroupExpr left_set = null, right_set = null;
int length1 = 0, length2 = 0;
right_set = (MethodGroupExpr) right_expr;
length2 = right_set.Methods.Length;
}
-
+
MemberInfo [] mi = new MemberInfo [length1 + length2];
if (left_set != null)
left_set.Methods.CopyTo (mi, 0);
Arguments = new ArrayList ();
Arguments.Add (new Argument (left, Argument.AType.Expression));
Arguments.Add (new Argument (right, Argument.AType.Expression));
-
+
method = Invocation.OverloadResolve (union, Arguments);
if (method != null)
return this;
OpCode opcode;
if (method != null) {
- if (method is MethodInfo) {
- Invocation.EmitArguments (ec, Arguments);
- ec.ig.Emit (OpCodes.Call, (MethodInfo) method);
- return;
- }
+
+ bool is_static = method.IsStatic;
+
+ // FIXME : I am just not able to get this right !!
+ // There's something wrong with this part which causes
+ // an InvalidProgramException if this code is emitted
+
+ //if (Arguments != null)
+ // Invocation.EmitArguments (ec, Arguments);
+
+ //if (is_static){
+ // if (method is MethodInfo)
+ // ig.Emit (OpCodes.Call, (MethodInfo) method);
+ // else
+ // ig.Emit (OpCodes.Call, (ConstructorInfo) method);
+ //} else {
+ // if (method is MethodInfo)
+ // ig.Emit (OpCodes.Callvirt, (MethodInfo) method);
+ // else
+ // ig.Emit (OpCodes.Callvirt, (ConstructorInfo) method);
+ //}
+
+ //return;
}
left.Emit (ec);
throw new Exception ("Expression of type " + a.Expr + " does not resolve its type");
}
- if (t == a.Expr.Type)
+ if (t == a.Expr.Type)
return 0;
-
+
// FIXME: Implement implicit conversions here.
// FIXME: Implement better conversion here.
if (Arguments != null)
EmitArguments (ec, Arguments);
- if (method.IsStatic){
+ if (is_static){
if (method is MethodInfo)
ec.ig.Emit (OpCodes.Call, (MethodInfo) method);
else
method = Invocation.OverloadResolve ((MethodGroupExpr) ml, Arguments);
- if (method == null){
+ if (method == null) {
tc.RootContext.Report.Error (-6,
"New invocation: Can not find a constructor for this argument list");
return null;