projects
/
mono.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
**** Merged from HEAD ****
[mono.git]
/
mcs
/
gmcs
/
ecore.cs
diff --git
a/mcs/gmcs/ecore.cs
b/mcs/gmcs/ecore.cs
index e760942258faf52bf0089050e55d46f5dd86b4a7..26b6c6f376eb0fe56329e910566f344af4de69d2 100755
(executable)
--- a/
mcs/gmcs/ecore.cs
+++ b/
mcs/gmcs/ecore.cs
@@
-314,10
+314,12
@@
namespace Mono.CSharp {
break;
case ExprClass.MethodGroup:
break;
case ExprClass.MethodGroup:
+ if (!RootContext.V2){
if ((flags & ResolveFlags.MethodGroup) == 0) {
((MethodGroupExpr) e).ReportUsageError ();
return null;
}
if ((flags & ResolveFlags.MethodGroup) == 0) {
((MethodGroupExpr) e).ReportUsageError ();
return null;
}
+ }
break;
case ExprClass.Value:
break;
case ExprClass.Value:
@@
-405,6
+407,12
@@
namespace Mono.CSharp {
/// </remarks>
public abstract void Emit (EmitContext ec);
/// </remarks>
public abstract void Emit (EmitContext ec);
+ public virtual void EmitBranchable (EmitContext ec, Label target, bool onTrue)
+ {
+ Emit (ec);
+ ec.ig.Emit (onTrue ? OpCodes.Brtrue : OpCodes.Brfalse, target);
+ }
+
/// <summary>
/// Protected constructor. Only derivate types should
/// be able to be created
/// <summary>
/// Protected constructor. Only derivate types should
/// be able to be created
@@
-663,11
+671,15
@@
namespace Mono.CSharp {
Report.Error (
122, loc, "`" + TypeManager.CSharpName (qualifier_type) + "." +
name + "' is inaccessible due to its protection level");
Report.Error (
122, loc, "`" + TypeManager.CSharpName (qualifier_type) + "." +
name + "' is inaccessible due to its protection level");
- else
+ else if (name == ".ctor") {
+ Report.Error (143, loc, String.Format ("The type {0} has no constructors defined",
+ TypeManager.CSharpName (queried_type)));
+ } else {
Report.Error (
122, loc, "`" + name + "' is inaccessible due to its " +
"protection level");
}
Report.Error (
122, loc, "`" + name + "' is inaccessible due to its " +
"protection level");
}
+ }
static public MemberInfo GetFieldFromEvent (EventExpr event_expr)
{
static public MemberInfo GetFieldFromEvent (EventExpr event_expr)
{
@@
-820,7
+832,7
@@
namespace Mono.CSharp {
"a `" + sb.ToString () + "' was expected");
}
"a `" + sb.ToString () + "' was expected");
}
- static void Error_ConstantValueCannotBeConverted (Location l, string val, Type t)
+ static
public
void Error_ConstantValueCannotBeConverted (Location l, string val, Type t)
{
Report.Error (31, l, "Constant value `" + val + "' cannot be converted to " +
TypeManager.CSharpName (t));
{
Report.Error (31, l, "Constant value `" + val + "' cannot be converted to " +
TypeManager.CSharpName (t));
@@
-1314,6
+1326,12
@@
namespace Mono.CSharp {
public class EmptyCast : Expression {
protected Expression child;
public class EmptyCast : Expression {
protected Expression child;
+ public Expression Child {
+ get {
+ return child;
+ }
+ }
+
public EmptyCast (Expression child, Type return_type)
{
eclass = child.eclass;
public EmptyCast (Expression child, Type return_type)
{
eclass = child.eclass;
@@
-1958,19
+1976,19
@@
namespace Mono.CSharp {
alias_value = null;
if (ec.ResolvingTypeTree){
alias_value = null;
if (ec.ResolvingTypeTree){
- if (alias_value != null){
- if ((t = RootContext.LookupType (ds, alias_value, true, loc)) != null)
- return new TypeExpression (t, loc);
- }
-
int errors = Report.Errors;
int errors = Report.Errors;
- Type dt =
ec.DeclSpace
.FindType (loc, Name);
+ Type dt =
ds
.FindType (loc, Name);
if (Report.Errors != errors)
return null;
if (dt != null)
return new TypeExpression (dt, loc);
if (Report.Errors != errors)
return null;
if (dt != null)
return new TypeExpression (dt, loc);
+
+ if (alias_value != null){
+ if ((t = RootContext.LookupType (ds, alias_value, true, loc)) != null)
+ return new TypeExpression (t, loc);
+ }
}
//
}
//
@@
-1984,12
+2002,9
@@
namespace Mono.CSharp {
return new SimpleName (alias_value, loc);
}
return new SimpleName (alias_value, loc);
}
- if (ec.IsGeneric){
- TypeParameterExpr generic_type = ds.LookupGeneric (Name, loc);
-
- if (generic_type != null)
- return generic_type.ResolveAsTypeTerminal (ec);
- }
+ TypeParameterExpr generic_type = ds.LookupGeneric (Name, loc);
+ if (generic_type != null)
+ return generic_type.ResolveAsTypeTerminal (ec);
//
// Stage 2: Lookup up if we are an alias to a type
//
// Stage 2: Lookup up if we are an alias to a type
@@
-2604,7
+2619,7
@@
namespace Mono.CSharp {
FieldBase fb = TypeManager.GetField (FieldInfo);
if (fb != null)
FieldBase fb = TypeManager.GetField (FieldInfo);
if (fb != null)
- fb.
IsAssigned = true
;
+ fb.
SetAssigned ()
;
//
// InitOnly fields can only be assigned in constructors
//
// InitOnly fields can only be assigned in constructors
@@
-2752,9
+2767,21
@@
namespace Mono.CSharp {
// Handle initonly fields specially: make a copy and then
// get the address of the copy.
//
// Handle initonly fields specially: make a copy and then
// get the address of the copy.
//
- if (FieldInfo.IsInitOnly && !ec.IsConstructor){
+ bool need_copy;
+ if (FieldInfo.IsInitOnly){
+ need_copy = true;
+ if (ec.IsConstructor){
+ if (FieldInfo.IsStatic){
+ if (ec.IsStatic)
+ need_copy = false;
+ } else
+ need_copy = false;
+ }
+ } else
+ need_copy = false;
+
+ if (need_copy){
LocalBuilder local;
LocalBuilder local;
-
Emit (ec);
local = ig.DeclareLocal (type);
ig.Emit (OpCodes.Stloc, local);
Emit (ec);
local = ig.DeclareLocal (type);
ig.Emit (OpCodes.Stloc, local);
@@
-2762,9
+2789,10
@@
namespace Mono.CSharp {
return;
}
return;
}
- if (FieldInfo.IsStatic)
+
+ if (FieldInfo.IsStatic){
ig.Emit (OpCodes.Ldsflda, FieldInfo);
ig.Emit (OpCodes.Ldsflda, FieldInfo);
- else {
+
}
else {
//
// In the case of `This', we call the AddressOf method, which will
// only load the pointer, and not perform an Ldobj immediately after
//
// In the case of `This', we call the AddressOf method, which will
// only load the pointer, and not perform an Ldobj immediately after