+2007-06-06 Marek Safar <marek.safar@gmail.com>
+
+ * ecore.cs (SimpleName.Emit): Emit unresolved simple name is internal
+ error not an user error.
+
+ * expression.cs (IsApplicable): Refactored to make debugging easier.
+
+ * support.cs: More tricks for non-mono runtimes.
+
+ * typemanager.cs (CoreLookupType): Made public.
+ (InitSystemCore): All linq specific stuff moved to linq.cs
+
2007-06-05 Marek Safar <marek.safar@gmail.com>
* typemanager.cs (CSharpSignature): One more missing build-in types
public override void Emit (EmitContext ec)
{
- //
- // If this is ever reached, then we failed to
- // find the name as a namespace
- //
-
- Error (103, "The name `" + Name +
- "' does not exist in the class `" +
- ec.DeclContainer.Name + "'");
+ throw new InternalErrorException ("The resolve phase was not executed");
}
public override string ToString ()
i--;
Argument a = (Argument) arguments [i];
-
+
Parameter.Modifier a_mod = a.Modifier &
~(Parameter.Modifier.OUTMASK | Parameter.Modifier.REFMASK);
Parameter.Modifier p_mod = pd.ParameterModifier (i) &
~(Parameter.Modifier.OUTMASK | Parameter.Modifier.REFMASK | Parameter.Modifier.PARAMS);
- if (a_mod == p_mod) {
- Type pt = pd.ParameterType (i);
- EmitContext prevec = EmitContext.TempEc;
- EmitContext.TempEc = ec;
-
- try {
- if (a_mod == Parameter.Modifier.NONE) {
- if (!TypeManager.IsEqual (a.Type, pt) &&
- !Convert.ImplicitConversionExists (ec, a.Expr, pt))
- return false;
- continue;
- }
- } finally {
- EmitContext.TempEc = prevec;
+ if (a_mod != p_mod)
+ return false;
+
+ Type pt = pd.ParameterType (i);
+ EmitContext prevec = EmitContext.TempEc;
+ EmitContext.TempEc = ec;
+
+ try {
+ if (a_mod == Parameter.Modifier.NONE) {
+ // It is already done in ImplicitConversion need to measure the performance, it causes problem in MWF
+ if (TypeManager.IsEqual (a.Type, pt))
+ continue;
+
+ if (!Convert.ImplicitConversionExists (ec, a.Expr, pt))
+ return false;
+ continue;
}
+ } finally {
+ EmitContext.TempEc = prevec;
+ }
- if (pt != a.Type)
- return false;
- } else
+ if (pt != a.Type)
return false;
}
}
continue;
}
-
+
if (types[i].IsGenericType) {
- Type[] gen_arguments = types[i].GetGenericTypeDefinition ().GetGenericArguments ();
- for (int ii = 0; ii < gen_arguments.Length; ++ii) {
- gen_arguments[ii] = argTypes[gen_arguments[ii].GenericParameterPosition];
+ Type[] gen_arguments_open = types[i].GetGenericTypeDefinition ().GetGenericArguments ();
+ Type[] gen_arguments = types[i].GetGenericArguments ();
+ for (int ii = 0; ii < gen_arguments_open.Length; ++ii) {
+ if (gen_arguments[ii].IsGenericParameter)
+ gen_arguments_open[ii] = argTypes[gen_arguments_open[ii].GenericParameterPosition];
+ else
+ gen_arguments_open[ii] = gen_arguments[ii];
}
- types[i] = types[i].GetGenericTypeDefinition ().MakeGenericType (gen_arguments);
+ types[i] = types[i].GetGenericTypeDefinition ().MakeGenericType (gen_arguments_open);
}
}
}
/// Looks up a type, and aborts if it is not found. This is used
/// by types required by the compiler
/// </summary>
- static Type CoreLookupType (string namespaceName, string name)
+ public static Type CoreLookupType (string namespaceName, string name)
{
return CoreLookupType (namespaceName, name, false);
}
}
#if GMCS_SOURCE
- public static MethodInfo enumerable_select;
-
static void InitSystemCore ()
{
if (RootContext.Version != LanguageVersion.LINQ)
if (extension_attribute_type != null)
extension_attribute_attr = new CustomAttributeBuilder (
GetConstructor (extension_attribute_type, Type.EmptyTypes), new object[0]);
-
- Type t = CoreLookupType ("System.Linq", "Enumerable");
- MemberList select = TypeManager.FindMembers (t, MemberTypes.Method, BindingFlags.Static | BindingFlags.Public,
- Type.FilterName, "Select");
-
- // TODO: implement correct selection
- enumerable_select = ((MethodInfo)select[0]);
}
#endif