return null;
}
+ public abstract bool IsNegative {
+ get;
+ }
+
//
// Returns true iff 1) the stack type of this is one of Object,
// int32, int64 and 2) this == 0 or this == null.
else
ec.ig.Emit (OpCodes.Ldc_I4_0);
}
-
+
+ public override bool IsNegative {
+ get {
+ return false;
+ }
+ }
+
public override bool IsZeroInteger {
get { return Value == false; }
}
{
return new IntConstant (Value);
}
-
+
+ public override bool IsNegative {
+ get {
+ return false;
+ }
+ }
+
public override bool IsZeroInteger {
get { return Value == 0; }
}
return new IntConstant (Value);
}
+ public override bool IsNegative {
+ get {
+ return false;
+ }
+ }
+
public override bool IsZeroInteger {
get { return Value == '\0'; }
}
{
return new IntConstant (Value);
}
+
+ public override bool IsNegative {
+ get {
+ return Value < 0;
+ }
+ }
public override bool IsZeroInteger {
get { return Value == 0; }
public override bool IsZeroInteger {
get { return Value == 0; }
}
+
+ public override bool IsNegative {
+ get {
+ return Value < 0;
+ }
+ }
}
public class UShortConstant : Constant {
{
return new IntConstant (Value);
}
-
+
+ public override bool IsNegative {
+ get {
+ return false;
+ }
+ }
+
public override bool IsZeroInteger {
get { return Value == 0; }
}
return this;
}
+ public override bool IsNegative {
+ get {
+ return Value < 0;
+ }
+ }
+
public override bool IsZeroInteger {
get { return Value == 0; }
}
return null;
}
+ public override bool IsNegative {
+ get {
+ return false;
+ }
+ }
+
public override bool IsZeroInteger {
get { return Value == 0; }
}
return null;
}
+ public override bool IsNegative {
+ get {
+ return Value < 0;
+ }
+ }
+
public override bool IsZeroInteger {
get { return Value == 0; }
}
{
return null;
}
-
+
+ public override bool IsNegative {
+ get {
+ return false;
+ }
+ }
+
public override bool IsZeroInteger {
get { return Value == 0; }
}
{
return null;
}
+
+ public override bool IsNegative {
+ get {
+ return Value < 0;
+ }
+ }
}
public class DoubleConstant : Constant {
{
return null;
}
+
+ public override bool IsNegative {
+ get {
+ return Value < 0;
+ }
+ }
}
public class DecimalConstant : Constant {
ig.Emit (OpCodes.Newobj, TypeManager.void_decimal_ctor_five_args);
}
+
+ public override bool IsNegative {
+ get {
+ return Value < 0;
+ }
+ }
}
public class StringConstant : Constant {
else
ec.ig.Emit (OpCodes.Ldstr, Value);
}
+
+ public override bool IsNegative {
+ get {
+ return false;
+ }
+ }
}
}
if (argtype == TypeManager.int32_type ||
argtype == TypeManager.uint32_type ||
argtype == TypeManager.int64_type ||
- argtype == TypeManager.uint64_type)
+ argtype == TypeManager.uint64_type) {
+ Constant c = a.Expr as Constant;
+ if (c != null && c.IsNegative) {
+ Report.Warning (251, 2, a.Expr.Location, "Indexing an array with a negative index (array indices always start at zero)");
+ }
continue;
+ }
//
// Mhm. This is strage, because the Argument.Type is not the same as
}
Constant c = count as Constant;
- // TODO: because we don't have property IsNegative
- if (c != null && c.ConvertToUInt () == null) {
+ if (c != null && c.IsNegative) {
Report.Error (247, loc, "Cannot use a negative size with stackalloc");
return null;
}