public virtual Expression DoResolveLValue (EmitContext ec, Expression right_side)
{
- return DoResolve (ec);
+ return null;
}
//
/// </remarks>
public Expression ResolveLValue (EmitContext ec, Expression right_side)
{
+ int errors = Report.Errors;
Expression e = DoResolveLValue (ec, right_side);
- if (e != null){
- if (e is SimpleName){
- SimpleName s = (SimpleName) e;
- MemberLookupFailed (ec, null, ec.ContainerType, s.Name,
- ec.DeclSpace.Name, loc);
- return null;
- }
+ if (e == null) {
+ if (errors == Report.Errors)
+ Report.Error (131, Location, "The left-hand side of an assignment or mutating operation must be a variable, property or indexer");
+ return null;
+ }
+ if (e != null){
if (e.eclass == ExprClass.Invalid)
throw new Exception ("Expression " + e +
" ExprClass is Invalid after resolve");
/// Returns an expression that can be used to invoke operator true
/// on the expression if it exists.
/// </summary>
- static public StaticCallExpr GetOperatorTrue (EmitContext ec, Expression e, Location loc)
+ static public Expression GetOperatorTrue (EmitContext ec, Expression e, Location loc)
{
return GetOperatorTrueOrFalse (ec, e, true, loc);
}
/// Returns an expression that can be used to invoke operator false
/// on the expression if it exists.
/// </summary>
- static public StaticCallExpr GetOperatorFalse (EmitContext ec, Expression e, Location loc)
+ static public Expression GetOperatorFalse (EmitContext ec, Expression e, Location loc)
{
return GetOperatorTrueOrFalse (ec, e, false, loc);
}
- static StaticCallExpr GetOperatorTrueOrFalse (EmitContext ec, Expression e, bool is_true, Location loc)
+ static Expression GetOperatorTrueOrFalse (EmitContext ec, Expression e, bool is_true, Location loc)
{
MethodBase method;
Expression operator_group;
+ if (TypeManager.IsNullableType (e.Type))
+ return new Nullable.OperatorTrueOrFalse (e, is_true, loc).Resolve (ec);
+
operator_group = MethodLookup (ec, e.Type, is_true ? "op_True" : "op_False", loc);
if (operator_group == null)
return null;
sb.Append (valid [i]);
}
- Error (119, "Expression denotes a `" + ExprClassName () + "' where " +
+ Report.Error (119, loc, "Expression denotes a `" + ExprClassName () + "' where " +
"a `" + sb.ToString () + "' was expected");
}
public EmptyCast (Expression child, Type return_type)
{
eclass = child.eclass;
+ loc = child.Location;
type = return_type;
this.child = child;
}
child.Emit (ec);
}
+ public override bool IsDefaultValue {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
public override bool IsNegative {
get {
return false;
{
return Child.ConvertToInt ();
}
-
+
+ public override bool IsDefaultValue {
+ get {
+ return Child.IsDefaultValue;
+ }
+ }
+
public override bool IsZeroInteger {
get { return Child.IsZeroInteger; }
}
int errors = Report.Errors;
dt = ec.ResolvingTypeTree
? ds.FindType (loc, Name)
- : ds.LookupType (Name, true, loc);
+ : ds.LookupType (Name, loc, /*silent=*/ true, /*ignore_cs0104=*/ false);
if (Report.Errors != errors)
return null;
/// section 10.8.1 (Fully Qualified Names).
/// </summary>
public abstract class FullNamedExpression : Expression {
+ public override FullNamedExpression ResolveAsTypeStep (EmitContext ec)
+ {
+ return this;
+ }
+
public abstract string FullName {
get;
}
protected override TypeExpr DoResolveAsTypeStep (EmitContext ec)
{
if (type == null) {
- FullNamedExpression t = ec.DeclSpace.LookupType (name, false, Location.Null);
+ FullNamedExpression t = ec.DeclSpace.LookupType (
+ name, Location.Null, /*silent=*/ false, /*ignore_cs0104=*/ false);
if (t == null)
return null;
if (!(t is TypeExpr))
if (is_volatile)
ig.Emit (OpCodes.Volatile);
- ig.Emit (OpCodes.Ldfld, FieldInfo);
+ IFixedBuffer ff = AttributeTester.GetFixedBuffer (FieldInfo);
+ if (ff != null)
+ {
+ ig.Emit (OpCodes.Ldflda, FieldInfo);
+ ig.Emit (OpCodes.Ldflda, ff.Element);
+ }
+ else {
+ ig.Emit (OpCodes.Ldfld, FieldInfo);
+ }
}
if (leave_copy) {
return true;
}
+ public override Expression DoResolveLValue (EmitContext ec, Expression right_side)
+ {
+ return DoResolve (ec);
+ }
+
public override Expression DoResolve (EmitContext ec)
{
if (instance_expr != null) {