+2002-09-06 Miguel de Icaza <miguel@ximian.com>
+
+ * expression.cs (Cast): Simplified by using ResolveType instead of
+ manually resolving.
+
+ * statement.cs (Catch): Fix bug by using ResolveType.
+
2002-09-06 Ravi Pratap <ravi@ximian.com>
* expression.cs (BetterConversion): Special case for when we have
int errors = Report.Errors;
- target_type = target_type.Resolve (ec, ResolveFlags.Type);
+ type = ec.DeclSpace.ResolveType (target_type, false, Location);
- if (target_type == null){
- if (errors == Report.Errors)
- Error (-10, "Can not resolve type");
+ if (type == null)
return null;
- }
- type = target_type.Type;
eclass = ExprClass.Value;
- if (type == null)
- return null;
-
if (expr is Constant){
Expression e = TryReduce (ec, type);
public readonly Block Block;
public readonly Location Location;
- Expression type;
+ Expression type_expr;
+ Type type;
public Catch (Expression type, string name, Block block, Location l)
{
- this.type = type;
+ type_expr = type;
Name = name;
Block = block;
Location = l;
public Type CatchType {
get {
- if (type == null)
- throw new InvalidOperationException ();
-
- return type.Type;
+ return type;
}
}
public bool Resolve (EmitContext ec)
{
- if (type != null) {
- type = type.DoResolve (ec);
+ if (type_expr != null) {
+ type = ec.DeclSpace.ResolveType (type_expr, false, Location);
if (type == null)
return false;
- Type t = type.Type;
- if (t != TypeManager.exception_type && !t.IsSubclassOf (TypeManager.exception_type)){
+ if (type != TypeManager.exception_type && !type.IsSubclassOf (TypeManager.exception_type)){
Report.Error (155, Location,
"The type caught or thrown must be derived " +
"from System.Exception");
return false;
}
- }
+ } else
+ type = null;
if (!Block.Resolve (ec))
return false;