IsAssigned = 1 << 12, // Field is assigned
HasExplicitLayout = 1 << 13,
PartialDefinitionExists = 1 << 14, // Set when corresponding partial method definition exists
- HasStructLayout = 1 << 15 // Has StructLayoutAttribute
+ HasStructLayout = 1 << 15, // Has StructLayoutAttribute
+ HasInstanceConstructor = 1 << 16,
+ HasUserOperators = 1 << 17
}
/// <summary>
return true;
}
+ //
+ // Does extension methods look up to find a method which matches name and extensionType.
+ // Search starts from this namespace and continues hierarchically up to top level.
+ //
public ExtensionMethodCandidates LookupExtensionMethod (TypeSpec extensionType, string name, int arity)
{
- return LookupExtensionMethod (this, extensionType, name, arity);
- }
+ var m = Parent;
+ do {
+ var ns = m as NamespaceContainer;
+ if (ns != null)
+ return ns.LookupExtensionMethod (this, extensionType, name, arity, ns, 0);
- protected virtual ExtensionMethodCandidates LookupExtensionMethod (IMemberContext invocationContext, TypeSpec extensionType, string name, int arity)
- {
- return Parent.LookupExtensionMethod (invocationContext, extensionType, name, arity);
+ m = m.Parent;
+ } while (m != null);
+
+ return null;
}
public virtual FullNamedExpression LookupNamespaceAlias (string name)
return (state & StateFlags.CLSCompliant) != 0;
}
- public bool IsConditionallyExcluded (CompilerContext ctx, Location loc)
+ public bool IsConditionallyExcluded (IMemberContext ctx, Location loc)
{
if ((Kind & (MemberKind.Class | MemberKind.Method)) == 0)
return false;
if (conditions == null)
return false;
- foreach (var condition in conditions) {
- if (loc.CompilationUnit.IsConditionalDefined (ctx, condition))
- return false;
+ var m = ctx.CurrentMemberDefinition;
+ CompilationSourceFile unit = null;
+ while (m != null && unit == null) {
+ unit = m as CompilationSourceFile;
+ m = m.Parent;
+ }
+
+ if (unit != null) {
+ foreach (var condition in conditions) {
+ if (unit.IsConditionalDefined (condition))
+ return false;
+ }
}
return true;