if (oa != null)
AttributeTester.Report_ObsoleteMessage (oa, TypeManager.CSharpSignature (method), loc);
+
oa = AttributeTester.GetObsoleteAttribute (method.DeclaringType);
if (oa != null) {
AttributeTester.Report_ObsoleteMessage (oa, method.DeclaringType.FullName, loc);
}
- //
- // This checks the `ConditionalAttribute' on the method
- //
- if (IsMethodExcluded (method, ec))
- return;
+ if (IsMethodExcluded (method, ec))
+ return;
if (!is_static){
if (decl_type.IsValueType)
return this;
Expression ml;
- ml = MemberLookupFinal (ec, null, type, ".ctor",
+ // For member-lookup, treat 'new Foo (bar)' as call to 'foo.ctor (bar)', where 'foo' is of type 'Foo'.
+ ml = MemberLookupFinal (ec, type, type, ".ctor",
MemberTypes.Constructor,
AllBindingFlags | BindingFlags.DeclaredOnly, loc);
/// initialization data and the other which does not need dimensions
/// specified but where initialization data is mandatory.
/// </remarks>
- public class ArrayCreation : ExpressionStatement {
+ public class ArrayCreation : Expression {
Expression requested_base_type;
ArrayList initializers;
//
// Emits the initializers for the array
//
- void EmitStaticInitializers (EmitContext ec, bool is_expression)
+ void EmitStaticInitializers (EmitContext ec)
{
//
// First, the static data
fb = RootContext.MakeStaticData (data);
- if (is_expression)
- ig.Emit (OpCodes.Dup);
+ ig.Emit (OpCodes.Dup);
ig.Emit (OpCodes.Ldtoken, fb);
ig.Emit (OpCodes.Call,
TypeManager.void_initializearray_array_fieldhandle);
//
// This always expect the top value on the stack to be the array
//
- void EmitDynamicInitializers (EmitContext ec, bool is_expression)
+ void EmitDynamicInitializers (EmitContext ec)
{
ILGenerator ig = ec.ig;
int dims = bounds.Count;
num_automatic_initializers <= max_automatic_initializers) {
Type etype = e.Type;
- if (is_expression || i != top - 1)
- ig.Emit (OpCodes.Dup);
+ ig.Emit (OpCodes.Dup);
for (int idx = 0; idx < dims; idx++)
IntConstant.EmitInt (ig, current_pos [idx]);
}
}
- void DoEmit (EmitContext ec, bool is_statement)
+ public override void Emit (EmitContext ec)
{
ILGenerator ig = ec.ig;
// initialized. num_automatic_initializers will always be zero. See
// CheckIndices.
if (num_automatic_initializers > max_automatic_initializers)
- EmitStaticInitializers (ec, dynamic_initializers || !is_statement);
+ EmitStaticInitializers (ec);
if (dynamic_initializers)
- EmitDynamicInitializers (ec, !is_statement);
+ EmitDynamicInitializers (ec);
}
}
-
- public override void Emit (EmitContext ec)
- {
- DoEmit (ec, false);
- }
-
- public override void EmitStatement (EmitContext ec)
- {
- DoEmit (ec, true);
- }
public object EncodeAsAttribute ()
{
MemberInfo [] mi = TypeManager.MemberLookup (
caller_type, caller_type, lookup_type, MemberTypes.Property,
BindingFlags.Public | BindingFlags.Instance |
- BindingFlags.DeclaredOnly, p_name);
+ BindingFlags.DeclaredOnly, p_name, null);
if (mi == null || mi.Length == 0)
return null;