+2006-03-20 Marek Safar <marek.safar@seznam.cz>
+
+ * assign.cs (CompoundAssign.ResolveSource): Removed.
+
+ * attribute.cs (ResolvePossibleAttributeType): Updated after MemberAccess
+ clean up.
+
+ * class.cs (TypeContainer.FindMethods): Removed.
+ (TypeContainer.CheckMemberUsage): Made static.
+
+ * codegen.cs (GetAssemblyName): Uses Length for empty string test.
+
+ * constant.cs (CheckRange): Removed unused type argument.
+ (CheckUnsigned): Removed unused type argument.
+
+ * cs-parser.jay: Updated after MemberAccess clean up.
+ Uses Length for empty string test.
+
+ * cs-tokenizer.cs: Uses Length for empty string test.
+ (IsCastToken): Made static.
+ (is_hex): Made static.
+ (real_type_suffix): Made static.
+
+ * decl.cs (SetupCache): Made static.
+ (OnGenerateDocComment): Removed unused ds argument.
+
+ * delegate.cs (VerifyDelegate): Removed unused argument.
+
+ * doc.cs: Uses Length for empty string test.
+
+ * driver.cs: Uses Length for empty string test.
+
+ * enum.cs (IsValidEnumType): Made static
+
+ * expression.cs (EnumLiftUp): Removed unused argument.
+ (ResolveMethodGroup): Ditto.
+ (BetterConversion): Ditto.
+ (GetVarargsTypes): Ditto.
+ (UpdateIndices): Ditto.
+ (ValidateInitializers): Ditto.
+ (MemberAccess.ctor): Ditto.
+ (GetIndexersForType): Ditto.
+
+ * flowanalysis.cs: (MergeFinally): Removed unused argument.
+
+ * iterators.cs: Updated after MemberAccess clean up.
+
+ * location.cs: Uses Length for empty string test.
+
+ * namespace.cs: Uses Length for empty string test.
+
+ * report.cs (CheckWarningCode): Made static.
+
+ * statement.cs (LabeledStatement): Removed unused argument.
+
+ * typemanager.cs (FilterNone): Removed.
+
2006-03-18 Marek Safar <marek.safar@seznam.cz>
* codegen.cs (EmitContext.TestObsoleteMethodUsage): Removed as it become
return new CompoundAssign (this, loc);
}
- public Expression ResolveSource (EmitContext ec)
- {
- return original_source.Resolve (ec);
- }
-
public override Expression DoResolve (EmitContext ec)
{
original_source = original_source.Resolve (ec);
if (LeftExpr == null) {
te = ResolveAsTypeTerminal (new SimpleName (name, Location), rc, silent);
} else {
- te = ResolveAsTypeTerminal (new MemberAccess (LeftExpr, name, Location), rc, silent);
+ te = ResolveAsTypeTerminal (new MemberAccess (LeftExpr, name), rc, silent);
}
if (te == null)
ps.AddPermission (perm);
}
- object GetValue (object value)
+ static object GetValue (object value)
{
if (value is EnumConstant)
return ((EnumConstant) value).GetValue ();
return new MemberList (t.FindMembers (mt, bf, filter, criteria));
}
- //
- // FindMethods will look for methods not only in the type `t', but in
- // any interfaces implemented by the type.
- //
- public static MethodInfo [] FindMethods (Type t, BindingFlags bf,
- MemberFilter filter, object criteria)
- {
- return null;
- }
-
/// <summary>
/// Emits the values for the constants
/// </summary>
return;
}
- void CheckMemberUsage (MemberCoreArrayList al, string member_type)
+ static void CheckMemberUsage (MemberCoreArrayList al, string member_type)
{
if (al == null)
return;
// FIXME: with a few effort, it could be done with XmlReader,
// that means removal of DOM use.
//
- internal override void OnGenerateDocComment (DeclSpace ds, XmlElement el)
+ internal override void OnGenerateDocComment (XmlElement el)
{
- DocUtil.OnMethodGenerateDocComment (this, ds, el);
+ DocUtil.OnMethodGenerateDocComment (this, el);
}
//
if (ParameterInfo.Count > 0) {
ArrayList al = (ArrayList)ParentContainer.MemberCache.Members [Name];
if (al.Count > 1)
- ParentContainer.MemberCache.VerifyClsParameterConflict (al, this, MethodBuilder);
+ MemberCache.VerifyClsParameterConflict (al, this, MethodBuilder);
}
return true;
if (ParameterInfo.Count > 0) {
ArrayList al = (ArrayList)Parent.MemberCache.Members [".ctor"];
if (al.Count > 3)
- Parent.MemberCache.VerifyClsParameterConflict (al, this, ConstructorBuilder);
+ MemberCache.VerifyClsParameterConflict (al, this, ConstructorBuilder);
if (Parent.TypeBuilder.IsSubclassOf (TypeManager.attribute_type)) {
foreach (Type param in ParameterTypes) {
}
else {
string value = a.GetString ();
- if (value != String.Empty)
+ if (value.Length != 0)
RootContext.StrongNameKeyFile = value;
}
break;
}
else {
string value = a.GetString ();
- if (value != String.Empty)
+ if (value.Length != 0)
RootContext.StrongNameKeyContainer = value;
}
break;
return retval;
}
- protected void CheckRange (EmitContext ec, ulong value, Type type, ulong max)
+ protected static void CheckRange (EmitContext ec, ulong value, ulong max)
{
if (!ec.ConstantCheckState)
return;
throw new OverflowException ();
}
- protected void CheckRange (EmitContext ec, double value, Type type, long min, long max)
+ protected static void CheckRange (EmitContext ec, double value, long min, long max)
{
if (!ec.ConstantCheckState)
return;
throw new OverflowException ();
}
- protected void CheckUnsigned (EmitContext ec, long value, Type type)
+ protected static void CheckUnsigned (EmitContext ec, long value)
{
if (!ec.ConstantCheckState)
return;
public override Constant Reduce (EmitContext ec, Type target_type)
{
if (target_type == TypeManager.sbyte_type) {
- CheckRange (ec, Value, target_type, SByte.MinValue, SByte.MaxValue);
+ CheckRange (ec, Value, SByte.MinValue, SByte.MaxValue);
return new SByteConstant ((sbyte) Value, Location);
}
if (target_type == TypeManager.short_type)
public override Constant Reduce (EmitContext ec, Type target_type)
{
if (target_type == TypeManager.byte_type) {
- CheckRange (ec, Value, target_type, Byte.MinValue, Byte.MaxValue);
+ CheckRange (ec, Value, Byte.MinValue, Byte.MaxValue);
return new ByteConstant ((byte) Value, Location);
}
if (target_type == TypeManager.sbyte_type) {
- CheckRange (ec, Value, target_type, SByte.MinValue, SByte.MaxValue);
+ CheckRange (ec, Value, SByte.MinValue, SByte.MaxValue);
return new SByteConstant ((sbyte) Value, Location);
}
if (target_type == TypeManager.short_type) {
- CheckRange (ec, Value, target_type, Int16.MinValue, Int16.MaxValue);
+ CheckRange (ec, Value, Int16.MinValue, Int16.MaxValue);
return new ShortConstant ((short) Value, Location);
}
if (target_type == TypeManager.int32_type)
public override Constant Reduce (EmitContext ec, Type target_type)
{
if (target_type == TypeManager.byte_type) {
- CheckUnsigned (ec, Value, target_type);
+ CheckUnsigned (ec, Value);
return new ByteConstant ((byte) Value, Location);
}
if (target_type == TypeManager.short_type)
return new ShortConstant ((short) Value, Location);
if (target_type == TypeManager.ushort_type) {
- CheckUnsigned (ec, Value, target_type);
+ CheckUnsigned (ec, Value);
return new UShortConstant ((ushort) Value, Location);
} if (target_type == TypeManager.int32_type)
return new IntConstant ((int) Value, Location);
if (target_type == TypeManager.uint32_type) {
- CheckUnsigned (ec, Value, target_type);
+ CheckUnsigned (ec, Value);
return new UIntConstant ((uint) Value, Location);
} if (target_type == TypeManager.int64_type)
return new LongConstant ((long) Value, Location);
if (target_type == TypeManager.uint64_type) {
- CheckUnsigned (ec, Value, target_type);
+ CheckUnsigned (ec, Value);
return new ULongConstant ((ulong) Value, Location);
}
if (target_type == TypeManager.float_type)
if (target_type == TypeManager.double_type)
return new DoubleConstant ((double) Value, Location);
if (target_type == TypeManager.char_type) {
- CheckUnsigned (ec, Value, target_type);
+ CheckUnsigned (ec, Value);
return new CharConstant ((char) Value, Location);
}
if (target_type == TypeManager.decimal_type)
public override Constant Reduce (EmitContext ec, Type target_type)
{
if (target_type == TypeManager.byte_type) {
- CheckRange (ec, Value, target_type, Byte.MinValue, Byte.MaxValue);
+ CheckRange (ec, Value, Byte.MinValue, Byte.MaxValue);
return new ByteConstant ((byte) Value, Location);
}
if (target_type == TypeManager.sbyte_type) {
- CheckRange (ec, Value, target_type, SByte.MinValue, SByte.MaxValue);
+ CheckRange (ec, Value, SByte.MinValue, SByte.MaxValue);
return new SByteConstant ((sbyte) Value, Location);
}
if (target_type == TypeManager.ushort_type) {
- CheckUnsigned (ec, Value, target_type);
+ CheckUnsigned (ec, Value);
return new UShortConstant ((ushort) Value, Location);
}
if (target_type == TypeManager.int32_type)
return new IntConstant ((int) Value, Location);
if (target_type == TypeManager.uint32_type) {
- CheckUnsigned (ec, Value, target_type);
+ CheckUnsigned (ec, Value);
return new UIntConstant ((uint) Value, Location);
}
if (target_type == TypeManager.int64_type)
return new LongConstant ((long) Value, Location);
if (target_type == TypeManager.uint64_type) {
- CheckUnsigned (ec, Value, target_type);
+ CheckUnsigned (ec, Value);
return new ULongConstant ((ulong) Value, Location);
}
if (target_type == TypeManager.float_type)
if (target_type == TypeManager.double_type)
return new DoubleConstant ((double) Value, Location);
if (target_type == TypeManager.char_type) {
- CheckRange (ec, Value, target_type, Char.MinValue, Char.MaxValue);
+ CheckRange (ec, Value, Char.MinValue, Char.MaxValue);
return new CharConstant ((char) Value, Location);
}
if (target_type == TypeManager.decimal_type)
public override Constant Reduce (EmitContext ec, Type target_type)
{
if (target_type == TypeManager.byte_type) {
- CheckRange (ec, Value, target_type, Byte.MinValue, Byte.MaxValue);
+ CheckRange (ec, Value, Byte.MinValue, Byte.MaxValue);
return new ByteConstant ((byte) Value, Location);
}
if (target_type == TypeManager.sbyte_type) {
- CheckRange (ec, Value, target_type, SByte.MinValue, SByte.MaxValue);
+ CheckRange (ec, Value, SByte.MinValue, SByte.MaxValue);
return new SByteConstant ((sbyte) Value, Location);
}
if (target_type == TypeManager.short_type) {
- CheckRange (ec, Value, target_type, Int16.MinValue, Int16.MaxValue);
+ CheckRange (ec, Value, Int16.MinValue, Int16.MaxValue);
return new ShortConstant ((short) Value, Location);
}
if (target_type == TypeManager.int32_type)
if (target_type == TypeManager.double_type)
return new DoubleConstant ((double) Value, Location);
if (target_type == TypeManager.char_type) {
- CheckRange (ec, Value, target_type, Char.MinValue, Char.MaxValue);
+ CheckRange (ec, Value, Char.MinValue, Char.MaxValue);
return new CharConstant ((char) Value, Location);
}
if (target_type == TypeManager.decimal_type)
public override Constant Reduce (EmitContext ec, Type target_type)
{
if (target_type == TypeManager.byte_type) {
- CheckRange (ec, Value, target_type, Byte.MinValue, Byte.MaxValue);
+ CheckRange (ec, Value, Byte.MinValue, Byte.MaxValue);
return new ByteConstant ((byte) Value, Location);
}
if (target_type == TypeManager.sbyte_type) {
- CheckRange (ec, Value, target_type, SByte.MinValue, SByte.MaxValue);
+ CheckRange (ec, Value, SByte.MinValue, SByte.MaxValue);
return new SByteConstant ((sbyte) Value, Location);
}
if (target_type == TypeManager.short_type) {
- CheckRange (ec, Value, target_type, Int16.MinValue, Int16.MaxValue);
+ CheckRange (ec, Value, Int16.MinValue, Int16.MaxValue);
return new ShortConstant ((short) Value, Location);
}
if (target_type == TypeManager.ushort_type) {
- CheckRange (ec, Value, target_type, UInt16.MinValue, UInt16.MaxValue);
+ CheckRange (ec, Value, UInt16.MinValue, UInt16.MaxValue);
return new UShortConstant ((ushort) Value, Location);
}
if (target_type == TypeManager.uint32_type) {
- CheckRange (ec, Value, target_type, Int32.MinValue, Int32.MaxValue);
+ CheckRange (ec, Value, Int32.MinValue, Int32.MaxValue);
return new UIntConstant ((uint) Value, Location);
}
if (target_type == TypeManager.int64_type)
return new LongConstant ((long) Value, Location);
if (target_type == TypeManager.uint64_type) {
- CheckUnsigned (ec, Value, target_type);
+ CheckUnsigned (ec, Value);
return new ULongConstant ((ulong) Value, Location);
}
if (target_type == TypeManager.float_type)
if (target_type == TypeManager.double_type)
return new DoubleConstant ((double) Value, Location);
if (target_type == TypeManager.char_type) {
- CheckRange (ec, Value, target_type, Char.MinValue, Char.MaxValue);
+ CheckRange (ec, Value, Char.MinValue, Char.MaxValue);
return new CharConstant ((char) Value, Location);
}
if (target_type == TypeManager.decimal_type)
public override Constant Reduce (EmitContext ec, Type target_type)
{
if (target_type == TypeManager.byte_type) {
- CheckRange (ec, Value, target_type, Char.MinValue, Char.MaxValue);
+ CheckRange (ec, Value, Char.MinValue, Char.MaxValue);
return new ByteConstant ((byte) Value, Location);
}
if (target_type == TypeManager.sbyte_type) {
- CheckRange (ec, Value, target_type, SByte.MinValue, SByte.MaxValue);
+ CheckRange (ec, Value, SByte.MinValue, SByte.MaxValue);
return new SByteConstant ((sbyte) Value, Location);
}
if (target_type == TypeManager.short_type) {
- CheckRange (ec, Value, target_type, Int16.MinValue, Int16.MaxValue);
+ CheckRange (ec, Value, Int16.MinValue, Int16.MaxValue);
return new ShortConstant ((short) Value, Location);
}
if (target_type == TypeManager.ushort_type) {
- CheckRange (ec, Value, target_type, UInt16.MinValue, UInt16.MaxValue);
+ CheckRange (ec, Value, UInt16.MinValue, UInt16.MaxValue);
return new UShortConstant ((ushort) Value, Location);
}
if (target_type == TypeManager.int32_type) {
- CheckRange (ec, Value, target_type, Int32.MinValue, Int32.MaxValue);
+ CheckRange (ec, Value, Int32.MinValue, Int32.MaxValue);
return new IntConstant ((int) Value, Location);
}
if (target_type == TypeManager.int64_type)
if (target_type == TypeManager.double_type)
return new DoubleConstant ((double) Value, Location);
if (target_type == TypeManager.char_type) {
- CheckRange (ec, Value, target_type, Char.MinValue, Char.MaxValue);
+ CheckRange (ec, Value, Char.MinValue, Char.MaxValue);
return new CharConstant ((char) Value, Location);
}
if (target_type == TypeManager.decimal_type)
public override Constant Reduce (EmitContext ec, Type target_type)
{
if (target_type == TypeManager.byte_type) {
- CheckRange (ec, Value, target_type, Byte.MinValue, Byte.MaxValue);
+ CheckRange (ec, Value, Byte.MinValue, Byte.MaxValue);
return new ByteConstant ((byte) Value, Location);
}
if (target_type == TypeManager.sbyte_type) {
- CheckRange (ec, Value, target_type, SByte.MinValue, SByte.MaxValue);
+ CheckRange (ec, Value, SByte.MinValue, SByte.MaxValue);
return new SByteConstant ((sbyte) Value, Location);
}
if (target_type == TypeManager.short_type) {
- CheckRange (ec, Value, target_type, Int16.MinValue, Int16.MaxValue);
+ CheckRange (ec, Value, Int16.MinValue, Int16.MaxValue);
return new ShortConstant ((short) Value, Location);
}
if (target_type == TypeManager.ushort_type) {
- CheckRange (ec, Value, target_type, UInt16.MinValue, UInt16.MaxValue);
+ CheckRange (ec, Value, UInt16.MinValue, UInt16.MaxValue);
return new UShortConstant ((ushort) Value, Location);
}
if (target_type == TypeManager.int32_type) {
- CheckRange (ec, Value, target_type, Int32.MinValue, Int32.MaxValue);
+ CheckRange (ec, Value, Int32.MinValue, Int32.MaxValue);
return new IntConstant ((int) Value, Location);
}
if (target_type == TypeManager.uint32_type) {
- CheckRange (ec, Value, target_type, UInt32.MinValue, UInt32.MaxValue);
+ CheckRange (ec, Value, UInt32.MinValue, UInt32.MaxValue);
return new UIntConstant ((uint) Value, Location);
}
if (target_type == TypeManager.uint64_type) {
- CheckUnsigned (ec, Value, target_type);
+ CheckUnsigned (ec, Value);
return new ULongConstant ((ulong) Value, Location);
}
if (target_type == TypeManager.float_type)
if (target_type == TypeManager.double_type)
return new DoubleConstant ((double) Value, Location);
if (target_type == TypeManager.char_type) {
- CheckRange (ec, Value, target_type, Char.MinValue, Char.MaxValue);
+ CheckRange (ec, Value, Char.MinValue, Char.MaxValue);
return new CharConstant ((char) Value, Location);
}
if (target_type == TypeManager.decimal_type)
public override Constant Reduce (EmitContext ec, Type target_type)
{
if (target_type == TypeManager.byte_type) {
- CheckRange (ec, Value, target_type, Byte.MaxValue);
+ CheckRange (ec, Value, Byte.MaxValue);
return new ByteConstant ((byte) Value, Location);
}
if (target_type == TypeManager.sbyte_type) {
- CheckRange (ec, Value, target_type, (ulong) SByte.MaxValue);
+ CheckRange (ec, Value, (ulong) SByte.MaxValue);
return new SByteConstant ((sbyte) Value, Location);
}
if (target_type == TypeManager.short_type) {
- CheckRange (ec, Value, target_type, (ulong) Int16.MaxValue);
+ CheckRange (ec, Value, (ulong) Int16.MaxValue);
return new ShortConstant ((short) Value, Location);
}
if (target_type == TypeManager.ushort_type) {
- CheckRange (ec, Value, target_type, UInt16.MaxValue);
+ CheckRange (ec, Value, UInt16.MaxValue);
return new UShortConstant ((ushort) Value, Location);
}
if (target_type == TypeManager.int32_type) {
- CheckRange (ec, Value, target_type, Int32.MaxValue);
+ CheckRange (ec, Value, Int32.MaxValue);
return new IntConstant ((int) Value, Location);
}
if (target_type == TypeManager.uint32_type) {
- CheckRange (ec, Value, target_type, UInt32.MaxValue);
+ CheckRange (ec, Value, UInt32.MaxValue);
return new UIntConstant ((uint) Value, Location);
}
if (target_type == TypeManager.int64_type) {
- CheckRange (ec, Value, target_type, (ulong) Int64.MaxValue);
+ CheckRange (ec, Value, (ulong) Int64.MaxValue);
return new LongConstant ((long) Value, Location);
}
if (target_type == TypeManager.float_type)
if (target_type == TypeManager.double_type)
return new DoubleConstant ((double) Value, Location);
if (target_type == TypeManager.char_type) {
- CheckRange (ec, Value, target_type, Char.MaxValue);
+ CheckRange (ec, Value, Char.MaxValue);
return new CharConstant ((char) Value, Location);
}
if (target_type == TypeManager.decimal_type)
public override Constant Reduce (EmitContext ec, Type target_type)
{
if (target_type == TypeManager.byte_type) {
- CheckRange (ec, Value, target_type, Byte.MinValue, Byte.MaxValue);
+ CheckRange (ec, Value, Byte.MinValue, Byte.MaxValue);
return new ByteConstant ((byte) Value, Location);
}
if (target_type == TypeManager.sbyte_type) {
- CheckRange (ec, Value, target_type, SByte.MinValue, SByte.MaxValue);
+ CheckRange (ec, Value, SByte.MinValue, SByte.MaxValue);
return new SByteConstant ((sbyte) Value, Location);
}
if (target_type == TypeManager.short_type)
if (target_type == TypeManager.float_type)
return new FloatConstant ((float) Value, Location);
if (target_type == TypeManager.char_type) {
- CheckRange (ec, Value, target_type, char.MinValue, char.MaxValue);
+ CheckRange (ec, Value, char.MinValue, char.MaxValue);
return new CharConstant ((char) Value, Location);
}
if (target_type == TypeManager.decimal_type)
syntax_error (lexer.Location, "namespace name expected");
current_namespace = new NamespaceEntry (
- current_namespace, file, name.GetName (), name.Location);
+ current_namespace, file, name.GetName ());
}
namespace_body opt_semicolon
{
: primary_expression DOT IDENTIFIER opt_type_argument_list
{
LocatedToken lt = (LocatedToken) $3;
- $$ = new MemberAccess ((Expression) $1, lt.Value,
- (TypeArguments) $4, lt.Location);
+ $$ = new MemberAccess ((Expression) $1, lt.Value, (TypeArguments) $4);
}
| predefined_type DOT IDENTIFIER opt_type_argument_list
{
LocatedToken lt = (LocatedToken) $3;
- $$ = new MemberAccess ((Expression) $1, lt.Value,
- (TypeArguments) $4, lt.Location);
+ $$ = new MemberAccess ((Expression) $1, lt.Value, (TypeArguments) $4);
}
;
LocatedToken lt = (LocatedToken) $3;
deref = new Unary (Unary.Operator.Indirection, (Expression) $1, lt.Location);
- $$ = new MemberAccess (deref, lt.Value, lt.Location);
+ $$ = new MemberAccess (deref, lt.Value);
}
;
: IDENTIFIER COLON
{
LocatedToken lt = (LocatedToken) $1;
- LabeledStatement labeled = new LabeledStatement (lt.Value, lt.Location);
+ LabeledStatement labeled = new LabeledStatement (lt.Location);
if (current_block.AddLabel (lt.Value, labeled, lt.Location))
current_block.AddStatement (labeled);
{
Namespace ns = current_namespace.NS;
- if (current_container.Name == ""){
- if (ns.Name != "")
+ if (current_container.Name.Length == 0){
+ if (ns.Name.Length != 0)
return new MemberName (ns.MemberName, class_name);
else
return class_name;
public CSharpParser (SeekableStreamReader reader, SourceFile file, ArrayList defines)
{
- current_namespace = new NamespaceEntry (null, file, null, Location.Null);
+ current_namespace = new NamespaceEntry (null, file, null);
this.name = file.Name;
this.file = file;
current_container = RootContext.Tree.Types;
RootContext.Tree.Types.NamespaceEntry = null;
}
-void CheckToken (int error, int yyToken, string msg, Location loc)
+static void CheckToken (int error, int yyToken, string msg, Location loc)
{
if (yyToken >= Token.FIRST_KEYWORD && yyToken <= Token.LAST_KEYWORD)
Report.Error (error, loc, "{0}: `{1}' is a keyword", msg, yyNames [yyToken].ToLower ());
// FIXME: This could be `Location.Push' but we have to
// find out why the MS compiler allows this
//
- Mono.CSharp.Location.Push (file, 0);
+ Mono.CSharp.Location.Push (file);
}
static bool is_identifier_start_character (char c)
return seen_digits;
}
- bool is_hex (int e)
+ static bool is_hex (int e)
{
return (e >= '0' && e <= '9') || (e >= 'A' && e <= 'F') || (e >= 'a' && e <= 'f');
}
- int real_type_suffix (int c)
+ static int real_type_suffix (int c)
{
int t;
return val;
}
- bool IsCastToken (int token)
+ static bool IsCastToken (int token)
{
switch (token) {
case Token.BANG:
//
bool PreProcessLine (string arg)
{
- if (arg == "")
+ if (arg.Length == 0)
return false;
if (arg == "default"){
ref_line = line;
ref_name = file_name;
- Location.Push (ref_name, line);
+ Location.Push (ref_name);
return true;
} else if (arg == "hidden"){
//
ref_name = Location.LookupFile (name);
file_name.HasLineDirective = true;
ref_name.HasLineDirective = true;
- Location.Push (ref_name, ref_line);
+ Location.Push (ref_name);
} else {
ref_line = System.Int32.Parse (arg);
}
//
void PreProcessDefinition (bool is_define, string arg)
{
- if (arg == "" || arg == "true" || arg == "false"){
+ if (arg.Length == 0 || arg == "true" || arg == "false"){
Report.Error (1001, Location, "Missing identifer to pre-processor directive");
return;
}
goto case "endif";
case "if":
- if (arg == ""){
+ if (arg.Length == 0){
Error_InvalidDirective ();
return true;
}
}
Expression lexpr = Left.GetTypeExpression ();
- return new MemberAccess (lexpr, Name, TypeArguments, Location);
+ return new MemberAccess (lexpr, Name, TypeArguments);
}
public MemberName Clone ()
// Raised (and passed an XmlElement that contains the comment)
// when GenerateDocComment is writing documentation expectedly.
//
- internal virtual void OnGenerateDocComment (DeclSpace ds, XmlElement intermediateNode)
+ internal virtual void OnGenerateDocComment (XmlElement intermediateNode)
{
}
/// <summary>
/// Bootstrap this member cache by doing a deep-copy of our base.
/// </summary>
- Hashtable SetupCache (MemberCache base_class)
+ static Hashtable SetupCache (MemberCache base_class)
{
Hashtable hash = new Hashtable ();
/// <summary>
/// Cls compliance check whether methods or constructors parameters differing only in ref or out, or in array rank
/// </summary>
- public void VerifyClsParameterConflict (ArrayList al, MethodCore method, MemberInfo this_builder)
+ ///
+ // TODO: refactor as method is always 'this'
+ public static void VerifyClsParameterConflict (ArrayList al, MethodCore method, MemberInfo this_builder)
{
EntryType tested_type = (method is Constructor ? EntryType.Constructor : EntryType.Method) | EntryType.Public;
/// Verifies whether the delegate in question is compatible with this one in
/// order to determine if instantiation from the same is possible.
/// </summary>
- public static bool VerifyDelegate (EmitContext ec, Type delegate_type, Type probe_type, Location loc)
+ public static bool VerifyDelegate (EmitContext ec, Type delegate_type, Location loc)
{
Expression ml = Expression.MemberLookup (
ec.ContainerType, delegate_type, "Invoke", loc);
Argument a = (Argument) Arguments [0];
- if (!a.ResolveMethodGroup (ec, loc))
+ if (!a.ResolveMethodGroup (ec))
return null;
Expression e = a.Expr;
if (mg != null)
return ResolveMethodGroupExpr (ec, mg);
- Type e_type = e.Type;
-
- if (!TypeManager.IsDelegateType (e_type)) {
+ if (!TypeManager.IsDelegateType (e.Type)) {
Report.Error (149, loc, "Method name expected");
return null;
}
// This is what MS' compiler reports. We could always choose
// to be more verbose and actually give delegate-level specifics
- if (!Delegate.VerifyDelegate (ec, type, e_type, loc)) {
- Report.Error (29, loc, "Cannot implicitly convert type '" + e_type + "' " +
+ if (!Delegate.VerifyDelegate (ec, type, loc)) {
+ Report.Error (29, loc, "Cannot implicitly convert type '" + e.Type + "' " +
"to type '" + type + "'");
return null;
}
XmlElement el = n as XmlElement;
if (el != null) {
- mc.OnGenerateDocComment (ds, el);
+ mc.OnGenerateDocComment (el);
// FIXME: it could be done with XmlReader
XmlNodeList nl = n.SelectNodes (".//include");
el.ParentNode.InsertBefore (el.OwnerDocument.CreateComment (" Include tag is invalid "), el);
keepIncludeNode = true;
}
- else if (path == "") {
+ else if (path.Length == 0) {
Report.Warning (1590, 1, mc.Location, "Invalid XML `include' element. Missing `path' attribute");
el.ParentNode.InsertBefore (el.OwnerDocument.CreateComment (" Include tag is invalid "), el);
keepIncludeNode = true;
if (ml == null)
return empty_member_infos;
- return FilterOverridenMembersOut (type, (MemberInfo []) ml);
+ return FilterOverridenMembersOut ((MemberInfo []) ml);
}
static bool IsOverride (PropertyInfo deriv_prop, PropertyInfo base_prop)
}
private static MemberInfo [] FilterOverridenMembersOut (
- Type type, MemberInfo [] ml)
+ MemberInfo [] ml)
{
if (ml == null)
return empty_member_infos;
type, MemberTypes.All,
BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Instance,
memberName, null);
- mis = FilterOverridenMembersOut (type, mis);
+ mis = FilterOverridenMembersOut (mis);
if (mis == null || mis.Length == 0)
return null;
if (warn419 && IsAmbiguous (mis))
// that means removal of DOM use.
//
internal static void OnMethodGenerateDocComment (
- MethodCore mc, DeclSpace ds, XmlElement el)
+ MethodCore mc, XmlElement el)
{
Hashtable paramTags = new Hashtable ();
foreach (XmlElement pelem in el.SelectNodes ("param")) {
int i;
string xname = pelem.GetAttribute ("name");
- if (xname == "")
+ if (xname.Length == 0)
continue; // really? but MS looks doing so
if (xname != "" && mc.Parameters.GetParameterByName (xname, out i) == null)
Report.Warning (1572, 2, mc.Location, "XML comment on `{0}' has a param tag for `{1}', but there is no parameter by that name",
return true;
case "/out":
- if (value == ""){
+ if (value.Length == 0){
Usage ();
Environment.Exit (1);
}
case "/define": {
string [] defs;
- if (value == ""){
+ if (value.Length == 0){
Usage ();
Environment.Exit (1);
}
case "/pkg": {
string packages;
- if (value == ""){
+ if (value.Length == 0){
Usage ();
Environment.Exit (1);
}
return true;
case "/recurse":
- if (value == ""){
+ if (value.Length == 0){
Report.Error (5, "-recurse requires an argument");
Environment.Exit (1);
}
case "/r":
case "/reference": {
- if (value == ""){
+ if (value.Length == 0){
Report.Error (5, "-reference requires an argument");
Environment.Exit (1);
}
return true;
}
case "/addmodule": {
- if (value == ""){
+ if (value.Length == 0){
Report.Error (5, arg + " requires an argument");
Environment.Exit (1);
}
return true;
}
case "/win32res": {
- if (value == "") {
+ if (value.Length == 0) {
Report.Error (5, arg + " requires an argument");
Environment.Exit (1);
}
return true;
}
case "/win32icon": {
- if (value == "") {
+ if (value.Length == 0) {
Report.Error (5, arg + " requires an argument");
Environment.Exit (1);
}
return true;
}
case "/doc": {
- if (value == ""){
+ if (value.Length == 0){
Report.Error (2006, arg + " requires an argument");
Environment.Exit (1);
}
case "/lib": {
string [] libdirs;
- if (value == ""){
+ if (value.Length == 0){
Report.Error (5, "/lib requires an argument");
Environment.Exit (1);
}
case "/nowarn": {
string [] warns;
- if (value == ""){
+ if (value.Length == 0){
Report.Error (5, "/nowarn requires an argument");
Environment.Exit (1);
}
case "/main":
case "/m":
- if (value == ""){
+ if (value.Length == 0){
Report.Error (5, arg + " requires an argument");
Environment.Exit (1);
}
for (i = 0; i < args.Length; i++){
string arg = args [i];
- if (arg == "")
+ if (arg.Length == 0)
continue;
if (arg.StartsWith ("@")){
Expression expr;
if (name.Left != null) {
Expression lexpr = name.Left.GetTypeExpression ();
- expr = new MemberAccess (lexpr, name.Basename, loc);
+ expr = new MemberAccess (lexpr, name.Basename);
} else {
expr = new SimpleName (name.Basename, loc);
}
}
}
- bool IsValidEnumType (Type t)
+ static bool IsValidEnumType (Type t)
{
return (t == TypeManager.int32_type || t == TypeManager.uint32_type || t == TypeManager.int64_type ||
t == TypeManager.byte_type || t == TypeManager.sbyte_type || t == TypeManager.short_type ||
+ "'");
}
- bool IsOfType (EmitContext ec, Type l, Type r, Type t, bool check_user_conversions)
+ static bool IsOfType (EmitContext ec, Type l, Type r, Type t, bool check_user_conversions)
{
if ((l == t) || (r == t))
return true;
return this;
}
- Constant EnumLiftUp (EmitContext ec, Constant left, Constant right)
+ Constant EnumLiftUp (Constant left, Constant right)
{
switch (oper) {
case Operator.BitwiseOr:
// The conversion rules are ignored in enum context but why
if (!ec.InEnumContext && lc != null && rc != null && (TypeManager.IsEnumType (left.Type) || TypeManager.IsEnumType (right.Type))) {
- left = lc = EnumLiftUp (ec, lc, rc);
+ left = lc = EnumLiftUp (lc, rc);
if (lc == null)
return null;
- right = rc = EnumLiftUp (ec, rc, lc);
+ right = rc = EnumLiftUp (rc, lc);
if (rc == null)
return null;
}
TypeManager.CSharpName (a.Expr.Type);
}
- public bool ResolveMethodGroup (EmitContext ec, Location loc)
+ public bool ResolveMethodGroup (EmitContext ec)
{
SimpleName sn = Expr as SimpleName;
if (sn != null)
/// q if a->q is better,
/// null if neither is better
/// </summary>
- static Type BetterConversion (EmitContext ec, Argument a, Type p, Type q, Location loc)
+ static Type BetterConversion (EmitContext ec, Argument a, Type p, Type q)
{
Type argument_type = TypeManager.TypeToCoreType (a.Type);
Expression argument_expr = a.Expr;
/// </remarks>
static bool BetterFunction (EmitContext ec, ArrayList args, int argument_count,
MethodBase candidate, bool candidate_params,
- MethodBase best, bool best_params, Location loc)
+ MethodBase best, bool best_params)
{
ParameterData candidate_pd = TypeManager.GetParameterData (candidate);
ParameterData best_pd = TypeManager.GetParameterData (best);
continue;
same = false;
- Type better = BetterConversion (ec, a, ct, bt, loc);
+ Type better = BetterConversion (ec, a, ct, bt);
// for each argument, the conversion to 'ct' should be no worse than
// the conversion to 'bt'.
if (BetterFunction (ec, Arguments, arg_count,
candidate, cand_params,
- method, method_params, loc)) {
+ method, method_params)) {
method = candidate;
method_params = cand_params;
}
bool cand_params = candidate_to_form != null && candidate_to_form.Contains (candidate);
if (!BetterFunction (ec, Arguments, arg_count,
method, method_params,
- candidate, cand_params,
- loc)) {
+ candidate, cand_params)) {
Report.SymbolRelatedToPreviousError (candidate);
ambiguous = candidate;
}
}
}
- static Type[] GetVarargsTypes (EmitContext ec, MethodBase mb,
- ArrayList arguments)
+ static Type[] GetVarargsTypes (MethodBase mb, ArrayList arguments)
{
ParameterData pd = TypeManager.GetParameterData (mb);
call_op = OpCodes.Callvirt;
if ((method.CallingConvention & CallingConventions.VarArgs) != 0) {
- Type[] varargs_types = GetVarargsTypes (ec, method, Arguments);
+ Type[] varargs_types = GetVarargsTypes (method, Arguments);
ig.EmitCall (call_op, (MethodInfo) method, varargs_types);
return;
}
return true;
}
- public void UpdateIndices (EmitContext ec)
+ public void UpdateIndices ()
{
int i = 0;
for (ArrayList probe = initializers; probe != null;) {
}
- public bool ValidateInitializers (EmitContext ec, Type array_type)
+ public bool ValidateInitializers (EmitContext ec)
{
if (initializers == null) {
return !expect_initializers;
if (!CheckIndices (ec, initializers, 0, false))
return false;
- UpdateIndices (ec);
+ UpdateIndices ();
if (arguments.Count != dimensions) {
Error_IncorrectArrayInitializer ();
// First step is to validate the initializers and fill
// in any missing bits
//
- if (!ValidateInitializers (ec, type))
+ if (!ValidateInitializers (ec))
return null;
if (arguments == null)
this.loc = loc;
}
- public bool ResolveBase (EmitContext ec)
+ public override Expression DoResolve (EmitContext ec)
{
eclass = ExprClass.Variable;
type = TypeManager.runtime_argument_handle_type;
- return true;
- }
-
- public override Expression DoResolve (EmitContext ec)
- {
- if (!ResolveBase (ec))
- return null;
- if (ec.IsFieldInitializer || !ec.CurrentBlock.Toplevel.HasVarargs) {
+ if (ec.IsFieldInitializer || !ec.CurrentBlock.Toplevel.HasVarargs)
+ {
Error (190, "The __arglist construct is valid only within " +
"a variable argument method.");
return null;
public override FullNamedExpression ResolveAsTypeStep (IResolveContext ec, bool silent)
{
if (alias == "global")
- return new MemberAccess (RootNamespace.Global, identifier, loc).ResolveAsTypeStep (ec, silent);
+ return new MemberAccess (RootNamespace.Global, identifier).ResolveAsTypeStep (ec, silent);
int errors = Report.Errors;
FullNamedExpression fne = ec.DeclContainer.NamespaceEntry.LookupAlias (alias);
Report.Error (431, loc, "`{0}' cannot be used with '::' since it denotes a type", alias);
return null;
}
- return new MemberAccess (fne, identifier, loc).ResolveAsTypeStep (ec, silent);
+ return new MemberAccess (fne, identifier).ResolveAsTypeStep (ec, silent);
}
public override Expression DoResolve (EmitContext ec)
}
}
- Expression retval = new MemberAccess (fne, identifier, loc).DoResolve (ec);
+ Expression retval = new MemberAccess (fne, identifier).DoResolve (ec);
if (retval == null)
return null;
Expression expr;
TypeArguments args;
- // TODO: Location can be removed
- public MemberAccess (Expression expr, string id, Location l)
+ public MemberAccess (Expression expr, string id)
{
this.expr = expr;
Identifier = id;
loc = expr.Location;
}
- public MemberAccess (Expression expr, string id, TypeArguments args,
- Location l)
- : this (expr, id, l)
+ public MemberAccess (Expression expr, string id, TypeArguments args)
+ : this (expr, id)
{
this.args = args;
}
BindingFlags.DeclaredOnly, p_name, null);
}
- static public Indexers GetIndexersForType (Type caller_type, Type lookup_type, Location loc)
+ static public Indexers GetIndexersForType (Type caller_type, Type lookup_type)
{
Indexers ix = empty;
bool found_any = false, found_any_getters = false;
Type lookup_type = indexer_type;
- Indexers ilist = Indexers.GetIndexersForType (current_type, lookup_type, loc);
+ Indexers ilist = Indexers.GetIndexersForType (current_type, lookup_type);
if (ilist.Properties != null) {
found_any = true;
foreach (Indexers.Indexer ix in ilist.Properties) {
bool found_any = false, found_any_setters = false;
- Indexers ilist = Indexers.GetIndexersForType (current_type, indexer_type, loc);
+ Indexers ilist = Indexers.GetIndexersForType (current_type, indexer_type);
if (ilist.Properties != null) {
found_any = true;
foreach (Indexers.Indexer ix in ilist.Properties) {
return result;
}
- protected void MergeFinally (FlowBranching branching, UsageVector f_origins,
+ protected static void MergeFinally (UsageVector f_origins,
MyBitVector f_params)
{
for (UsageVector vector = f_origins; vector != null; vector = vector.Next) {
}
}
- public void MergeFinally (FlowBranching branching, UsageVector f_vector,
+ public void MergeFinally (UsageVector f_vector,
UsageVector f_origins)
{
if (parameters != null) {
if (f_vector != null) {
- MergeFinally (branching, f_origins, f_vector.Parameters);
+ MergeFinally (f_origins, f_vector.Parameters);
MyBitVector.Or (ref parameters, f_vector.ParameterVector);
} else
- MergeFinally (branching, f_origins, parameters);
+ MergeFinally (f_origins, parameters);
}
if (f_vector != null && f_vector.LocalVector != null)
{
UsageVector vector = Merge (catch_vectors);
- vector.MergeFinally (this, finally_vector, finally_origins);
+ vector.MergeFinally (finally_vector, finally_origins);
return vector;
}
Expression ce = new MemberAccess (
new SimpleName ("System.Threading.Interlocked", Location),
- "CompareExchange", Location);
+ "CompareExchange");
Expression pc = new FieldExpression (this, pc_field);
Expression before = new IntLiteral ((int) State.Running, Location);
// </remarks>
static public SourceFile LookupFile (string name)
{
- string path = name == "" ? "" : Path.GetFullPath (name);
+ string path = name.Length == 0 ? "" : Path.GetFullPath (name);
if (!source_files.Contains (path)) {
if (source_count >= (1 << checkpoint_bits))
return (SourceFile) source_list [index - 1];
}
- static public void Push (SourceFile file, int line)
+ static public void Push (SourceFile file)
{
current_source = file.Index;
// File is always pushed before being changed.
protected void EnsureNamespace (string dotted_name)
{
- if (dotted_name != null && dotted_name != "" && ! IsNamespace (dotted_name))
+ if (dotted_name != null && dotted_name.Length != 0 && ! IsNamespace (dotted_name))
GetNamespace (dotted_name, true);
}
throw new InternalErrorException ("Namespace has a null fullname");
if (parent != null && parent.MemberName != MemberName.Null)
- MemberName = new MemberName (
- parent.MemberName, name, parent.MemberName.Location);
- else if (name == "")
+ MemberName = new MemberName (parent.MemberName, name, parent.MemberName.Location);
+ else if (name.Length == 0)
MemberName = MemberName.Null;
else
MemberName = new MemberName (name, Location.Null);
t = tdecl.TypeBuilder;
}
}
- string lookup = t != null ? t.FullName : (fullname == "" ? name : fullname + "." + name);
+ string lookup = t != null ? t.FullName : (fullname.Length == 0 ? name : fullname + "." + name);
Type rt = root.LookupTypeReflection (lookup, loc);
if (t == null)
t = rt;
}
}
- public NamespaceEntry (NamespaceEntry parent, SourceFile file, string name, Location loc)
+ public NamespaceEntry (NamespaceEntry parent, SourceFile file, string name)
{
this.parent = parent;
this.file = file;
return result;
}
- bool CheckWarningCode (int code, Location loc)
+ static bool CheckWarningCode (int code, Location loc)
{
if (Report.IsValidWarning (code))
return true;
FlowBranching.UsageVector vectors;
- public LabeledStatement (string label_name, Location l)
+ public LabeledStatement (Location l)
{
this.loc = l;
}
if (!FetchGetCurrent (ec, return_type))
get_current = new PropertyExpr (
ec.ContainerType, TypeManager.ienumerator_getcurrent, loc);
- if (!FetchMoveNext (ec, return_type))
+ if (!FetchMoveNext (return_type))
move_next = TypeManager.bool_movenext_void;
return true;
}
if (return_type.IsInterface ||
- !FetchMoveNext (ec, return_type) ||
+ !FetchMoveNext (return_type) ||
!FetchGetCurrent (ec, return_type)) {
enumerator_type = return_type;
move_next = TypeManager.bool_movenext_void;
// find if they support the GetEnumerator pattern.
//
- if (TypeManager.HasElementType (return_type) || !FetchMoveNext (ec, return_type) || !FetchGetCurrent (ec, return_type)) {
+ if (TypeManager.HasElementType (return_type) || !FetchMoveNext (return_type) || !FetchGetCurrent (ec, return_type)) {
Report.Error (202, loc, "foreach statement requires that the return type `{0}' of `{1}' must have a suitable public MoveNext method and public Current property",
TypeManager.CSharpName (return_type), TypeManager.CSharpSignature (mi));
return false;
//
// Retrieves a `public bool MoveNext ()' method from the Type `t'
//
- bool FetchMoveNext (EmitContext ec, Type t)
+ bool FetchMoveNext (Type t)
{
MemberList move_next_list;
// uses NonPublic for both protected and private), we need to distinguish.
//
- static internal bool FilterNone (MemberInfo m, object filter_criteria)
- {
- return true;
- }
-
internal class Closure {
internal bool private_ok;