}
}
+ //
+ // Different context is needed when resolving type container base
+ // types. Type names come from the parent scope but type parameter
+ // names from the container scope.
+ //
+ struct BaseContext : IResolveContext
+ {
+ TypeContainer tc;
+
+ public BaseContext (TypeContainer tc)
+ {
+ this.tc = tc;
+ }
+
+ #region IResolveContext Members
+
+ public DeclSpace DeclContainer {
+ get { return tc.Parent; }
+ }
+
+ public bool IsInObsoleteScope {
+ get { return tc.IsInObsoleteScope; }
+ }
+
+ public bool IsInUnsafeScope {
+ get { return tc.IsInUnsafeScope; }
+ }
+
+ public FullNamedExpression LookupNamespaceOrType (string name, Location loc, bool ignore_cs0104)
+ {
+ return tc.Parent.LookupNamespaceOrType (name, loc, ignore_cs0104);
+ }
+
+ public DeclSpace GenericDeclContainer {
+ get { return tc.GenericDeclContainer; }
+ }
+
+ #endregion
+ }
+
[Flags]
enum CachedMethods
{
TypeExpr base_type;
TypeExpr[] iface_exprs;
Type GenericType;
-#if GMCS_SOURCE
GenericTypeParameterBuilder[] nested_gen_params;
-#endif
protected ArrayList type_bases;
compiler_generated.Add (c);
}
- public override void ApplyAttributeBuilder (Attribute a, CustomAttributeBuilder cb)
+ public override void ApplyAttributeBuilder (Attribute a, CustomAttributeBuilder cb, PredefinedAttributes pa)
{
- if (a.Type == TypeManager.default_member_type) {
+ if (a.Type == pa.DefaultMember) {
if (Indexers != null) {
Report.Error (646, a.Location, "Cannot specify the `DefaultMember' attribute on type containing an indexer");
return;
}
}
- base.ApplyAttributeBuilder (a, cb);
+ base.ApplyAttributeBuilder (a, cb, pa);
}
public override AttributeTargets AttributeTargets {
public bool IsComImport {
get {
- if (OptAttributes == null || TypeManager.comimport_attr_type == null)
+ if (OptAttributes == null)
return false;
- return OptAttributes.Contains (TypeManager.comimport_attr_type);
+ return OptAttributes.Contains (PredefinedAttributes.Get.ComImport);
}
}
}
}
- //
- // Emits the instance field initializers
- //
- public bool EmitFieldInitializers (EmitContext ec)
- {
- if (partial_parts != null) {
- foreach (TypeContainer part in partial_parts)
- part.EmitFieldInitializers (ec);
- }
-
- ArrayList fields;
-
- if (ec.IsStatic){
- fields = initialized_static_fields;
- } else {
- fields = initialized_fields;
- }
-
- if (fields == null)
- return true;
-
- foreach (FieldInitializer f in fields) {
- f.EmitStatement (ec);
- }
- return true;
- }
-
public override string DocComment {
get {
return comment;
int count = type_bases.Count;
TypeExpr [] ifaces = null;
+ IResolveContext base_context = new BaseContext (this);
for (int i = 0, j = 0; i < count; i++){
FullNamedExpression fne = (FullNamedExpression) type_bases [i];
// it does ObsoleteAttribute and constraint checks which require
// base type to be set
//
- TypeExpr fne_resolved = fne.ResolveAsBaseTerminal (this, false);
+ TypeExpr fne_resolved = fne.ResolveAsBaseTerminal (base_context, false);
if (fne_resolved == null)
continue;
if (i == 0 && Kind == Kind.Class && !fne_resolved.Type.IsInterface) {
- base_class = fne_resolved;
+ if (fne_resolved is DynamicTypeExpr)
+ Report.Error (1965, Location, "Class `{0}' cannot derive from the dynamic type",
+ GetSignatureForError ());
+ else
+ base_class = fne_resolved;
continue;
}
}
}
- if (Kind == Kind.Interface && !fne_resolved.AsAccessible (this)) {
+ if (Kind == Kind.Interface && !IsAccessibleAs (fne_resolved.Type)) {
Report.Error (61, fne.Location,
"Inconsistent accessibility: base interface `{0}' is less accessible than interface `{1}'",
fne_resolved.GetSignatureForError (), GetSignatureForError ());
return false;
}
- ModuleBuilder builder = CodeGen.Module.Builder;
+ ModuleBuilder builder = Module.Builder;
TypeBuilder = builder.DefineType (
Name, TypeAttr, default_parent, type_size);
} else {
TypeManager.AddUserType (this);
-#if GMCS_SOURCE
if (IsGeneric) {
string[] param_names = new string [TypeParameters.Length];
for (int i = 0; i < TypeParameters.Length; i++)
param_names [i] = TypeParameters [i].Name;
+#if GMCS_SOURCE
GenericTypeParameterBuilder[] gen_params = TypeBuilder.DefineGenericParameters (param_names);
int offset = CountTypeParameters - CurrentTypeParameters.Length;
for (int i = offset; i < gen_params.Length; i++)
CurrentTypeParameters [i - offset].Define (gen_params [i]);
- }
+#else
+ nested_gen_params = null;
+ throw new NotSupportedException ();
#endif
+ }
return true;
}
}
}
-#if GMCS_SOURCE
void UpdateTypeParameterConstraints (TypeContainer part)
{
TypeParameter[] current_params = CurrentTypeParameters;
GetSignatureForError (), current_params [i].GetSignatureForError ());
}
}
-#endif
public bool ResolveType ()
{
protected virtual bool DoResolveType ()
{
-#if GMCS_SOURCE
if (!IsGeneric)
return true;
}
CurrentType = current_type.Type;
-#endif
return true;
}
GenericTypeExpr ct = iface as GenericTypeExpr;
if (ct != null) {
- if (!ct.CheckConstraints (this) || !ct.VerifyVariantTypeParameters ())
+ // TODO: passing `this' is wrong, should be base type iface instead
+ TypeManager.CheckTypeVariance (ct.Type, Variance.Covariant, this);
+
+ if (!ct.CheckConstraints (this))
return false;
}
}
if ((ct != null) && !ct.CheckConstraints (this))
return false;
+ TypeContainer baseContainer = TypeManager.LookupTypeContainer(base_type.Type);
+ if (baseContainer != null)
+ baseContainer.Define();
+
member_cache = new MemberCache (base_type.Type, this);
} else if (Kind == Kind.Interface) {
member_cache = new MemberCache (null, this);
if (requires_delayed_unmanagedtype_check) {
requires_delayed_unmanagedtype_check = false;
- foreach (Field f in fields) {
+ foreach (FieldBase f in fields) {
if (f.MemberType != null && f.MemberType.IsPointer)
TypeManager.VerifyUnManaged (f.MemberType, f.Location);
}
GenericType = CurrentType;
}
-#if GMCS_SOURCE
//
// FIXME: This hack is needed because member cache does not work
// with generic types, we rely on runtime to inflate dynamic types.
// TODO: This hack requires member cache refactoring to be removed
//
- if (TypeBuilder.IsGenericType)
+ if (TypeManager.IsGenericType (TypeBuilder))
member_cache = new MemberCache (this);
-#endif
return true;
}
if (!seen_normal_indexers)
return;
- if (TypeManager.default_member_ctor == null) {
- if (TypeManager.default_member_type == null) {
- TypeManager.default_member_type = TypeManager.CoreLookupType (
- "System.Reflection", "DefaultMemberAttribute", Kind.Class, true);
-
- if (TypeManager.default_member_type == null)
- return;
- }
-
- TypeManager.default_member_ctor = TypeManager.GetPredefinedConstructor (
- TypeManager.default_member_type, Location, TypeManager.string_type);
-
- if (TypeManager.default_member_ctor == null)
- return;
- }
+ PredefinedAttribute pa = PredefinedAttributes.Get.DefaultMember;
+ if (pa.Constructor == null &&
+ !pa.ResolveConstructor (Location, TypeManager.string_type))
+ return;
- CustomAttributeBuilder cb = new CustomAttributeBuilder (TypeManager.default_member_ctor, new string [] { IndexerName });
+ CustomAttributeBuilder cb = new CustomAttributeBuilder (pa.Constructor, new string [] { IndexerName });
TypeBuilder.SetCustomAttribute (cb);
}
}
}
- public override void ApplyAttributeBuilder (Attribute a, CustomAttributeBuilder cb)
+ public override void ApplyAttributeBuilder (Attribute a, CustomAttributeBuilder cb, PredefinedAttributes pa)
{
if (a.IsValidSecurityAttribute ()) {
if (declarative_security == null)
return;
}
- if (a.Type == TypeManager.struct_layout_attribute_type) {
+ if (a.Type == pa.StructLayout) {
PartialContainer.HasStructLayout = true;
if (a.GetLayoutKindValue () == LayoutKind.Explicit)
PartialContainer.HasExplicitLayout = true;
}
- base.ApplyAttributeBuilder (a, cb);
+ base.ApplyAttributeBuilder (a, cb, pa);
}
/// <summary>
base.AddBasesForPart (part, bases);
}
- public override void ApplyAttributeBuilder(Attribute a, CustomAttributeBuilder cb)
+ public override void ApplyAttributeBuilder (Attribute a, CustomAttributeBuilder cb, PredefinedAttributes pa)
{
- if (a.Type == TypeManager.attribute_usage_type) {
+ if (a.Type == pa.AttributeUsage) {
if (!TypeManager.IsAttributeType (BaseType) &&
TypeBuilder.FullName != "System.Attribute") {
Report.Error (641, a.Location, "Attribute `{0}' is only valid on classes derived from System.Attribute", a.GetSignatureForError ());
}
}
- if (a.Type == TypeManager.conditional_attribute_type && !TypeManager.IsAttributeType (BaseType)) {
+ if (a.Type == pa.Conditional && !TypeManager.IsAttributeType (BaseType)) {
Report.Error (1689, a.Location, "Attribute `System.Diagnostics.ConditionalAttribute' is only valid on methods or attribute classes");
return;
}
- if (a.Type == TypeManager.comimport_attr_type && TypeManager.guid_attr_type != null &&
- !attributes.Contains (TypeManager.guid_attr_type)) {
- a.Error_MissingGuidAttribute ();
- return;
+ if (a.Type == pa.ComImport && !attributes.Contains (pa.Guid)) {
+ a.Error_MissingGuidAttribute ();
+ return;
}
- if (a.Type == TypeManager.extension_attribute_type) {
+ if (a.Type == pa.Extension) {
a.Error_MisusedExtensionAttribute ();
return;
}
if (AttributeTester.IsAttributeExcluded (a.Type, Location))
return;
- base.ApplyAttributeBuilder (a, cb);
+ base.ApplyAttributeBuilder (a, cb, pa);
}
public override AttributeTargets AttributeTargets {
{
base.Emit ();
-#if GMCS_SOURCE
if ((ModFlags & Modifiers.METHOD_EXTENSION) != 0)
- TypeBuilder.SetCustomAttribute (TypeManager.extension_attribute_attr);
-#endif
+ PredefinedAttributes.Get.Extension.EmitAttribute (TypeBuilder);
}
protected override TypeExpr[] ResolveBaseTypes (out TypeExpr base_class)
return ifaces;
}
- if (!base_class.AsAccessible (this)) {
+ if (!IsAccessibleAs (base_class.Type)) {
Report.SymbolRelatedToPreviousError (base_class.Type);
Report.Error (60, Location, "Inconsistent accessibility: base class `{0}' is less accessible than class `{1}'",
TypeManager.CSharpName (base_class.Type), GetSignatureForError ());
if (OptAttributes == null)
return false;
- if (TypeManager.conditional_attribute_type == null)
- return false;
-
- Attribute[] attrs = OptAttributes.SearchMulti (TypeManager.conditional_attribute_type);
-
+ Attribute[] attrs = OptAttributes.SearchMulti (PredefinedAttributes.Get.Conditional);
if (attrs == null)
return false;
}
public sealed class Struct : ClassOrStruct {
+
+ bool is_unmanaged, has_unmanaged_check_done;
+
// <summary>
// Modifiers allowed in a struct declaration
// </summary>
this.ModFlags |= Modifiers.SEALED;
}
- public override void ApplyAttributeBuilder (Attribute a, CustomAttributeBuilder cb)
+ public override void ApplyAttributeBuilder (Attribute a, CustomAttributeBuilder cb, PredefinedAttributes pa)
{
- base.ApplyAttributeBuilder (a, cb);
+ base.ApplyAttributeBuilder (a, cb, pa);
//
// When struct constains fixed fixed and struct layout has explicitly
// set CharSet, its value has to be propagated to compiler generated
// fixed field types
//
- if (a.Type == TypeManager.struct_layout_attribute_type && Fields != null && a.HasField ("CharSet")) {
+ if (a.Type == pa.StructLayout && Fields != null && a.HasField ("CharSet")) {
for (int i = 0; i < Fields.Count; ++i) {
FixedField ff = Fields [i] as FixedField;
if (ff != null)
if (requires_delayed_unmanagedtype_check)
return true;
+ if (has_unmanaged_check_done)
+ return is_unmanaged;
+
+ has_unmanaged_check_done = true;
+
foreach (FieldBase f in fields) {
if ((f.ModFlags & Modifiers.STATIC) != 0)
continue;
// struct S { S* s; }
Type mt = f.MemberType;
if (mt == null) {
+ has_unmanaged_check_done = false;
requires_delayed_unmanagedtype_check = true;
return true;
}
return false;
}
+ is_unmanaged = true;
return true;
}
get {
const TypeAttributes DefaultTypeAttributes =
TypeAttributes.SequentialLayout |
- TypeAttributes.Sealed |
- TypeAttributes.BeforeFieldInit;
+ TypeAttributes.Sealed;
return base.TypeAttr | DefaultTypeAttributes;
}
this.ModFlags = Modifiers.Check (AllowedModifiers, mod, accmods, name.Location);
}
- public override void ApplyAttributeBuilder (Attribute a, CustomAttributeBuilder cb)
+ public override void ApplyAttributeBuilder (Attribute a, CustomAttributeBuilder cb, PredefinedAttributes pa)
{
- if (a.Type == TypeManager.comimport_attr_type && TypeManager.guid_attr_type != null &&
- !attributes.Contains (TypeManager.guid_attr_type)) {
- a.Error_MissingGuidAttribute ();
- return;
+ if (a.Type == pa.ComImport && !attributes.Contains (pa.Guid)) {
+ a.Error_MissingGuidAttribute ();
+ return;
}
- base.ApplyAttributeBuilder (a, cb);
+
+ base.ApplyAttributeBuilder (a, cb, pa);
}
if ((ModFlags & Modifiers.OVERRIDE) != 0) {
ObsoleteAttribute oa = AttributeTester.GetMethodObsoleteAttribute (base_method);
if (oa != null) {
- if (OptAttributes == null || TypeManager.obsolete_attribute_type == null || !OptAttributes.Contains (TypeManager.obsolete_attribute_type)) {
+ if (OptAttributes == null || !OptAttributes.Contains (PredefinedAttributes.Get.Obsolete)) {
Report.SymbolRelatedToPreviousError (base_method);
Report.Warning (672, 1, Location, "Member `{0}' overrides obsolete member `{1}'. Add the Obsolete attribute to `{0}'",
GetSignatureForError (), TypeManager.CSharpSignature (base_method));
}
} else {
- if (OptAttributes != null && TypeManager.obsolete_attribute_type != null && OptAttributes.Contains (TypeManager.obsolete_attribute_type)) {
+ if (OptAttributes != null && OptAttributes.Contains (PredefinedAttributes.Get.Obsolete)) {
Report.SymbolRelatedToPreviousError (base_method);
Report.Warning (809, 1, Location, "Obsolete member `{0}' overrides non-obsolete member `{1}'",
GetSignatureForError (), TypeManager.CSharpSignature (base_method));
if (!IsInterface && (base_method.IsVirtual || base_method.IsAbstract)) {
Report.Warning (114, 2, Location, "`{0}' hides inherited member `{1}'. To make the current member override that implementation, add the override keyword. Otherwise add the new keyword",
GetSignatureForError (), TypeManager.CSharpSignature (base_method));
+ if (base_method.IsAbstract){
+ Report.Error (533, Location, "`{0}' hides inherited abstract member `{1}'",
+ GetSignatureForError (), TypeManager.CSharpSignature (base_method));
+ ok = false;
+ }
} else {
Report.Warning (108, 2, Location, "`{0}' hides inherited member `{1}'. Use the new keyword if hiding was intended",
GetSignatureForError (), TypeManager.CSharpSignature (base_method));
bool error = false;
for (int i = 0; i < parameters.Count; ++i) {
Parameter p = parameters [i];
+
+ if (p.HasDefaultValue && (IsExplicitImpl || this is Operator || (this is Indexer && parameters.Count == 1)))
+ p.Warning_UselessOptionalParameter ();
+
if (p.CheckAccessibility (this))
continue;
public override void Emit()
{
// for extern static method must be specified either DllImport attribute or MethodImplAttribute.
- // We are more strict than Microsoft and report CS0626 as error
+ // We are more strict than csc and report this as an error because SRE does not allow emit that
if ((ModFlags & Modifiers.EXTERN) != 0 && !is_external_implementation) {
- Report.Error (626, Location,
- "`{0}' is marked as an external but has no DllImport attribute. Consider adding a DllImport attribute to specify the external implementation",
- GetSignatureForError ());
+ if (this is Constructor) {
+ Report.Error (824, Location,
+ "Constructor `{0}' is marked `external' but has no external implementation specified", GetSignatureForError ());
+ } else {
+ Report.Error (626, Location,
+ "`{0}' is marked as an external but has no DllImport attribute. Consider adding a DllImport attribute to specify the external implementation",
+ GetSignatureForError ());
+ }
}
base.Emit ();
{
}
- public override void ApplyAttributeBuilder (Attribute a, CustomAttributeBuilder cb)
+ public override void ApplyAttributeBuilder (Attribute a, CustomAttributeBuilder cb, PredefinedAttributes pa)
{
if (a.Target == AttributeTargets.ReturnValue) {
if (return_attributes == null)
return_attributes = new ReturnParameter (MethodBuilder, Location);
- return_attributes.ApplyAttributeBuilder (a, cb);
+ return_attributes.ApplyAttributeBuilder (a, cb, pa);
return;
}
is_external_implementation = true;
}
- if (a.Type == TypeManager.dllimport_type) {
+ if (a.Type == pa.DllImport) {
const int extern_static = Modifiers.EXTERN | Modifiers.STATIC;
if ((ModFlags & extern_static) != extern_static) {
Report.Error (601, a.Location, "The DllImport attribute must be specified on a method marked `static' and `extern'");
MethodBuilder = MethodData.MethodBuilder;
-#if GMCS_SOURCE
- if (MethodBuilder.IsGenericMethod)
+ if (TypeManager.IsGenericMethod (MethodBuilder))
Parent.MemberCache.AddGenericMember (MethodBuilder, this);
-#endif
Parent.MemberCache.AddMember (MethodBuilder, this);
if ((ModFlags & Modifiers.PARTIAL) != 0) {
for (int i = 0; i < Parameters.Count; ++i) {
- if (Parameters.FixedParameters[i].ModFlags == Parameter.Modifier.OUT) {
+ IParameterData p = Parameters.FixedParameters [i];
+ if (p.ModFlags == Parameter.Modifier.OUT) {
Report.Error (752, Location, "`{0}': A partial method parameters cannot use `out' modifier",
GetSignatureForError ());
- break;
}
+
+ if (p.HasDefaultValue && IsPartialImplementation)
+ ((Parameter) p).Warning_UselessOptionalParameter ();
}
}
}
public override void Emit ()
{
-#if GMCS_SOURCE
if ((ModFlags & Modifiers.COMPILER_GENERATED) != 0 && !Parent.IsCompilerGenerated)
- MethodBuilder.SetCustomAttribute (TypeManager.GetCompilerGeneratedAttribute (Location));
+ PredefinedAttributes.Get.CompilerGenerated.EmitAttribute (MethodBuilder);
if ((ModFlags & Modifiers.DEBUGGER_HIDDEN) != 0)
- MethodBuilder.SetCustomAttribute (TypeManager.GetDebuggerHiddenAttribute (Location));
-#endif
+ PredefinedAttributes.Get.DebuggerHidden.EmitAttribute (MethodBuilder);
+
+ if (TypeManager.IsDynamicType (ReturnType)) {
+ return_attributes = new ReturnParameter (MethodBuilder, Location);
+ return_attributes.EmitPredefined (PredefinedAttributes.Get.Dynamic, Location);
+ }
+
if (OptAttributes != null)
OptAttributes.Emit ();
if (OptAttributes == null)
return false;
- if (TypeManager.conditional_attribute_type == null)
- return false;
-
- Attribute[] attrs = OptAttributes.SearchMulti (TypeManager.conditional_attribute_type);
+ Attribute[] attrs = OptAttributes.SearchMulti (PredefinedAttributes.Get.Conditional);
if (attrs == null)
return false;
const int AllowedInterfaceModifiers =
Modifiers.NEW | Modifiers.UNSAFE;
+ Method partialMethodImplementation;
+
public Method (DeclSpace parent, GenericMethod generic,
FullNamedExpression return_type, int mod,
MemberName name, ParametersCompiled parameters, Attributes attrs)
(Parameters[0].ModFlags & ~Parameter.Modifier.PARAMS) == Parameter.Modifier.NONE;
}
- public override void ApplyAttributeBuilder (Attribute a, CustomAttributeBuilder cb)
+ public override void ApplyAttributeBuilder (Attribute a, CustomAttributeBuilder cb, PredefinedAttributes pa)
{
- if (a.Type == TypeManager.conditional_attribute_type) {
+ if (a.Type == pa.Conditional) {
if (IsExplicitImpl) {
Error_ConditionalAttributeIsNotValid ();
return;
}
}
- if (a.Type == TypeManager.extension_attribute_type) {
+ if (a.Type == pa.Extension) {
a.Error_MisusedExtensionAttribute ();
return;
}
- base.ApplyAttributeBuilder (a, cb);
+ base.ApplyAttributeBuilder (a, cb, pa);
}
protected override bool CheckForDuplications ()
if (!base.Define ())
return false;
+ if (partialMethodImplementation != null && IsPartialDefinition)
+ MethodBuilder = partialMethodImplementation.MethodBuilder;
+
if (RootContext.StdLib && TypeManager.IsSpecialType (ReturnType)) {
Error1599 (Location, ReturnType);
return false;
return true;
if (Parameters.HasExtensionMethodType) {
- if (Parent.IsStaticClass && !Parent.IsGeneric) {
+ if (Parent.PartialContainer.IsStaticClass && !Parent.IsGeneric) {
if (!Parent.IsTopLevel)
Report.Error (1109, Location, "`{0}': Extension methods cannot be defined in a nested class",
GetSignatureForError ());
- if (TypeManager.extension_attribute_type == null) {
+ PredefinedAttribute pa = PredefinedAttributes.Get.Extension;
+ if (!pa.IsDefined) {
Report.Error (1110, Location,
"`{0}': Extension methods cannot be declared without a reference to System.Core.dll assembly. Add the assembly reference or remove `this' modifer from the first parameter",
GetSignatureForError ());
- } else if (TypeManager.extension_attribute_attr == null) {
- ConstructorInfo ci = TypeManager.GetPredefinedConstructor (
- TypeManager.extension_attribute_type, Location, System.Type.EmptyTypes);
-
- if (ci != null)
- TypeManager.extension_attribute_attr = new CustomAttributeBuilder (ci, new object [0]);
}
ModFlags |= Modifiers.METHOD_EXTENSION;
- Parent.ModFlags |= Modifiers.METHOD_EXTENSION;
+ Parent.PartialContainer.ModFlags |= Modifiers.METHOD_EXTENSION;
CodeGen.Assembly.HasExtensionMethods = true;
} else {
Report.Error (1106, Location, "`{0}': Extension methods must be defined in a non-generic static class",
Report.Debug (64, "METHOD EMIT", this, MethodBuilder, Location, Block, MethodData);
if (IsPartialDefinition) {
//
- // Do attribute checks only when partial implementation does not exist
+ // Use partial method implementation builder for partial method declaration attributes
//
- if (MethodBuilder == null)
- base.Emit ();
-
- return;
- }
-
- if ((ModFlags & Modifiers.PARTIAL) != 0 && (caching_flags & Flags.PartialDefinitionExists) == 0)
+ if (partialMethodImplementation != null) {
+ MethodBuilder = partialMethodImplementation.MethodBuilder;
+ return;
+ }
+ } else if ((ModFlags & Modifiers.PARTIAL) != 0 && (caching_flags & Flags.PartialDefinitionExists) == 0) {
Report.Error (759, Location, "A partial method `{0}' implementation is missing a partial method declaration",
GetSignatureForError ());
+ }
base.Emit ();
-#if GMCS_SOURCE
if ((ModFlags & Modifiers.METHOD_EXTENSION) != 0)
- MethodBuilder.SetCustomAttribute (TypeManager.extension_attribute_attr);
-#endif
-
+ PredefinedAttributes.Get.Extension.EmitAttribute (MethodBuilder);
} catch {
Console.WriteLine ("Internal compiler error at {0}: exception caught while emitting {1}",
Location, MethodBuilder);
public void SetPartialDefinition (Method methodDefinition)
{
caching_flags |= Flags.PartialDefinitionExists;
- methodDefinition.MethodBuilder = MethodBuilder;
+ methodDefinition.partialMethodImplementation = this;
+
+ for (int i = 0; i < methodDefinition.Parameters.Count; ++i ) {
+ Parameters [i].DefaultValue = methodDefinition.Parameters [i].DefaultValue;
+ }
+
if (methodDefinition.attributes == null)
return;
public abstract class ConstructorInitializer : ExpressionStatement
{
- ArrayList argument_list;
+ Arguments argument_list;
MethodGroupExpr base_constructor_group;
-
- public ConstructorInitializer (ArrayList argument_list, Location loc)
+
+ public ConstructorInitializer (Arguments argument_list, Location loc)
{
this.argument_list = argument_list;
this.loc = loc;
}
- public ArrayList Arguments {
+ public Arguments Arguments {
get {
return argument_list;
}
throw new NotSupportedException ("ET");
}
- public bool Resolve (ConstructorBuilder caller_builder, EmitContext ec)
+ public ExpressionStatement Resolve (ConstructorBuilder caller_builder, EmitContext ec)
{
- if (argument_list != null){
- foreach (Argument a in argument_list){
- if (!a.Resolve (ec, loc))
- return false;
+ if (argument_list != null) {
+ bool dynamic;
+ argument_list.Resolve (ec, out dynamic);
+ if (dynamic) {
+ SimpleName ctor = new SimpleName (ConstructorBuilder.ConstructorName, loc);
+ return new DynamicInvocation (ctor, argument_list, loc).Resolve (ec) as ExpressionStatement;
}
}
if (this is ConstructorBaseInitializer) {
if (ec.ContainerType.BaseType == null)
- return true;
+ return this;
type = ec.ContainerType.BaseType;
if (TypeManager.IsStruct (ec.ContainerType)) {
Report.Error (522, loc,
"`{0}': Struct constructors cannot call base constructors", TypeManager.CSharpSignature (caller_builder));
- return false;
+ return this;
}
} else {
//
// struct D { public D (int a) : this () {}
//
if (TypeManager.IsStruct (ec.ContainerType) && argument_list == null)
- return true;
+ return this;
type = ec.ContainerType;
}
loc) as MethodGroupExpr;
if (base_constructor_group == null)
- return false;
+ return this;
base_constructor_group = base_constructor_group.OverloadResolve (
ec, ref argument_list, false, loc);
if (base_constructor_group == null)
- return false;
+ return this;
ConstructorInfo base_ctor = (ConstructorInfo)base_constructor_group;
Report.Error (516, loc, "Constructor `{0}' cannot call itself", TypeManager.CSharpSignature (caller_builder));
}
- return true;
+ return this;
}
public override Expression DoResolve (EmitContext ec)
}
public class ConstructorBaseInitializer : ConstructorInitializer {
- public ConstructorBaseInitializer (ArrayList argument_list, Location l) :
+ public ConstructorBaseInitializer (Arguments argument_list, Location l) :
base (argument_list, l)
{
}
}
public class ConstructorThisInitializer : ConstructorInitializer {
- public ConstructorThisInitializer (ArrayList argument_list, Location l) :
+ public ConstructorThisInitializer (Arguments argument_list, Location l) :
base (argument_list, l)
{
}
(Initializer.Arguments == null);
}
- public override void ApplyAttributeBuilder (Attribute a, CustomAttributeBuilder cb)
+ public override void ApplyAttributeBuilder (Attribute a, CustomAttributeBuilder cb, PredefinedAttributes pa)
{
if (a.IsValidSecurityAttribute ()) {
if (declarative_security == null) {
public override void Emit ()
{
if ((ModFlags & Modifiers.DEBUGGER_HIDDEN) != 0)
- ConstructorBuilder.SetCustomAttribute (TypeManager.GetDebuggerHiddenAttribute (Location));
+ PredefinedAttributes.Get.DebuggerHidden.EmitAttribute (ConstructorBuilder);
if (OptAttributes != null)
OptAttributes.Emit ();
//
if (Initializer != null) {
ec.IsStatic = true;
- Initializer.Resolve (ConstructorBuilder, ec);
+ ExpressionStatement expr = Initializer.Resolve (ConstructorBuilder, ec);
ec.IsStatic = false;
- block.AddScopeStatement (new StatementExpression (Initializer));
+ block.AddScopeStatement (new StatementExpression (expr));
}
}
}
// Encapsulates most of the Method's state
//
public class MethodData {
-#if GMCS_SOURCE
static FieldInfo methodbuilder_attrs_field;
-#endif
public readonly IMethodData method;
public readonly GenericMethod GenericMethod;
if (builder == null) {
builder = container.TypeBuilder.DefineMethod (
method_name, flags, method.CallingConventions,
- method.ReturnType, param.GetEmitTypes ());
+ TypeManager.TypeToReflectionType (method.ReturnType),
+ param.GetEmitTypes ());
return;
}
//
builder.SetParameters (param.GetEmitTypes ());
builder.SetReturnType (method.ReturnType);
-
+#endif
if (builder.Attributes != flags) {
try {
if (methodbuilder_attrs_field == null)
Report.RuntimeMissingSupport (method.Location, "Generic method MethodAttributes");
}
}
-#else
- throw new InternalErrorException ();
-#endif
}
//
ModFlags |= Modifiers.PROTECTED;
}
- public override void ApplyAttributeBuilder(Attribute a, CustomAttributeBuilder cb)
+ public override void ApplyAttributeBuilder (Attribute a, CustomAttributeBuilder cb, PredefinedAttributes pa)
{
- if (a.Type == TypeManager.conditional_attribute_type) {
+ if (a.Type == pa.Conditional) {
Error_ConditionalAttributeIsNotValid ();
return;
}
- base.ApplyAttributeBuilder (a, cb);
+ base.ApplyAttributeBuilder (a, cb, pa);
}
protected override bool CheckBase ()
// TODO: Should use AddScopeStatement or something else which emits correct
// debugger scope
//
- finaly_block.AddStatement (new StatementExpression (new Invocation (method_expr, new ArrayList (0))));
+ finaly_block.AddStatement (new StatementExpression (new Invocation (method_expr, new Arguments (0))));
new_block.AddStatement (new TryFinally (try_block, finaly_block, Location));
block = new_block;
"accessible than field `" + GetSignatureForError () + "'");
}
}
-#if GMCS_SOURCE
- if (MemberType.IsGenericParameter && (MemberType.GenericParameterAttributes & GenericParameterAttributes.Contravariant) != 0) {
- Report.Error (-33, Location, "Contravariant type parameters can only be used in input positions");
- }
-#endif
+
+ Variance variance = this is Event ? Variance.Contravariant : Variance.Covariant;
+ TypeManager.CheckTypeVariance (MemberType, variance, this);
}
protected bool IsTypePermitted ()
}
}
- public override void ApplyAttributeBuilder (Attribute a, CustomAttributeBuilder cb)
+ public override void ApplyAttributeBuilder (Attribute a, CustomAttributeBuilder cb, PredefinedAttributes pa)
{
- if (a.Type == TypeManager.field_offset_attribute_type) {
+ if (a.Type == pa.FieldOffset) {
status |= Status.HAS_OFFSET;
if (!Parent.PartialContainer.HasExplicitLayout) {
}
#if NET_2_0
- if (a.Type == TypeManager.fixed_buffer_attr_type) {
+ if (a.Type == pa.FixedBuffer) {
Report.Error (1716, Location, "Do not use 'System.Runtime.CompilerServices.FixedBuffer' attribute. Use the 'fixed' field modifier instead");
return;
}
#endif
#if !NET_2_0
- if (a.Type == TypeManager.marshal_as_attr_type) {
+ if (a.Type == pa.MarshalAs) {
UnmanagedMarshal marshal = a.GetMarshal (this);
if (marshal != null) {
FieldBuilder.SetMarshal (marshal);
return true;
}
- if ((ModFlags & (Modifiers.NEW | Modifiers.OVERRIDE)) == 0) {
+ if ((ModFlags & (Modifiers.NEW | Modifiers.OVERRIDE | Modifiers.BACKING_FIELD)) == 0) {
Report.SymbolRelatedToPreviousError (conflict_symbol);
Report.Warning (108, 2, Location, "`{0}' hides inherited member `{1}'. Use the new keyword if hiding was intended",
GetSignatureForError (), TypeManager.GetFullNameSignature (conflict_symbol));
public override void Emit ()
{
-#if GMCS_SOURCE
+ if (TypeManager.IsDynamicType (member_type))
+ PredefinedAttributes.Get.Dynamic.EmitAttribute (FieldBuilder);
+
if ((ModFlags & Modifiers.COMPILER_GENERATED) != 0 && !Parent.IsCompilerGenerated)
- FieldBuilder.SetCustomAttribute (TypeManager.GetCompilerGeneratedAttribute (Location));
-#endif
+ PredefinedAttributes.Get.CompilerGenerated.EmitAttribute (FieldBuilder);
if (OptAttributes != null) {
OptAttributes.Emit ();
// Create nested fixed buffer container
string name = String.Format ("<{0}>__FixedBuffer{1}", Name, GlobalCounter++);
- fixed_buffer_type = Parent.TypeBuilder.DefineNestedType (name, CodeGen.Module.DefaultCharSetType |
+ fixed_buffer_type = Parent.TypeBuilder.DefineNestedType (name, Parent.Module.DefaultCharSetType |
TypeAttributes.NestedPublic | TypeAttributes.Sealed | TypeAttributes.BeforeFieldInit, TypeManager.value_type);
element = fixed_buffer_type.DefineField (FixedElementName, MemberType, FieldAttributes.Public);
buffer_size *= type_size;
EmitFieldSize (buffer_size);
-#if GMCS_SOURCE
- //
- // Emit compiler generated fixed buffer type attribute
- //
- CustomAttributeBuilder cab = TypeManager.unsafe_value_type_attr;
- if (cab == null) {
- Type attr_type = TypeManager.CoreLookupType (
- "System.Runtime.CompilerServices", "UnsafeValueTypeAttribute", Kind.Class, true);
-
- if (attr_type != null) {
- ConstructorInfo ci = TypeManager.GetPredefinedConstructor (attr_type, Location);
- if (ci != null) {
- cab = new CustomAttributeBuilder (ci, new object [0]);
- TypeManager.unsafe_value_type_attr = cab;
- }
- }
- }
+ PredefinedAttributes.Get.UnsafeValueType.EmitAttribute (fixed_buffer_type);
- if (cab != null)
- fixed_buffer_type.SetCustomAttribute (cab);
-#endif
base.Emit ();
}
void EmitFieldSize (int buffer_size)
{
- if (TypeManager.struct_layout_attribute_type == null) {
- TypeManager.struct_layout_attribute_type = TypeManager.CoreLookupType (
- "System.Runtime.InteropServices", "StructLayoutAttribute", Kind.Class, true);
+ CustomAttributeBuilder cab;
+ PredefinedAttribute pa;
- if (TypeManager.struct_layout_attribute_type == null)
+ pa = PredefinedAttributes.Get.StructLayout;
+ if (pa.Constructor == null &&
+ !pa.ResolveConstructor (Location, TypeManager.short_type))
return;
- }
+ // TODO: It's not cleared
if (fi == null)
- fi = new FieldInfo [] { TypeManager.struct_layout_attribute_type.GetField ("Size") };
-
- object [] fi_val = new object [] { buffer_size };
-
- if (TypeManager.struct_layout_attribute_ctor == null) {
- TypeManager.struct_layout_attribute_ctor = TypeManager.GetPredefinedConstructor (
- TypeManager.struct_layout_attribute_type, Location, TypeManager.short_type);
- if (TypeManager.struct_layout_attribute_ctor == null)
- return;
- }
+ fi = new FieldInfo[] { pa.Type.GetField ("Size") };
- CustomAttributeBuilder cab = new CustomAttributeBuilder (TypeManager.struct_layout_attribute_ctor,
+ object[] fi_val = new object[] { buffer_size };
+ cab = new CustomAttributeBuilder (pa.Constructor,
ctor_args, fi, fi_val);
fixed_buffer_type.SetCustomAttribute (cab);
// Don't emit FixedBufferAttribute attribute for private types
//
if ((ModFlags & Modifiers.PRIVATE) != 0)
- return;
-
- if (TypeManager.fixed_buffer_attr_ctor == null) {
- if (TypeManager.fixed_buffer_attr_type == null) {
- TypeManager.fixed_buffer_attr_type = TypeManager.CoreLookupType (
- "System.Runtime.CompilerServices", "FixedBufferAttribute", Kind.Class, true);
-
- if (TypeManager.fixed_buffer_attr_type == null)
- return;
- }
+ return;
- TypeManager.fixed_buffer_attr_ctor = TypeManager.GetPredefinedConstructor (TypeManager.fixed_buffer_attr_type,
- Location, TypeManager.type_type, TypeManager.int32_type);
-
- if (TypeManager.fixed_buffer_attr_ctor == null)
- return;
- }
+ pa = PredefinedAttributes.Get.FixedBuffer;
+ if (pa.Constructor == null &&
+ !pa.ResolveConstructor (Location, TypeManager.type_type, TypeManager.int32_type))
+ return;
- cab = new CustomAttributeBuilder (TypeManager.fixed_buffer_attr_ctor, new object [] { MemberType, buffer_size });
+ cab = new CustomAttributeBuilder (pa.Constructor, new object[] { MemberType, buffer_size });
FieldBuilder.SetCustomAttribute (cab);
}
MemberType == TypeManager.sbyte_type || MemberType == TypeManager.byte_type ||
MemberType == TypeManager.short_type || MemberType == TypeManager.ushort_type ||
MemberType == TypeManager.int32_type || MemberType == TypeManager.uint32_type ||
- MemberType == TypeManager.float_type)
+ MemberType == TypeManager.float_type ||
+ MemberType == TypeManager.intptr_type || MemberType == TypeManager.uintptr_type)
return true;
if (TypeManager.IsEnumType (MemberType))
#endregion
- public override void ApplyAttributeBuilder(Attribute a, CustomAttributeBuilder cb)
+ public override void ApplyAttributeBuilder (Attribute a, CustomAttributeBuilder cb, PredefinedAttributes pa)
{
- if (a.Type == TypeManager.cls_compliant_attribute_type || a.Type == TypeManager.obsolete_attribute_type ||
- a.Type == TypeManager.conditional_attribute_type) {
+ if (a.Type == pa.CLSCompliant || a.Type == pa.Obsolete || a.Type == pa.Conditional) {
Report.Error (1667, a.Location,
"Attribute `{0}' is not valid on property or event accessors. It is valid on `{1}' declarations only",
TypeManager.CSharpName (a.Type), a.GetValidTargets ());
if (return_attributes == null)
return_attributes = new ReturnParameter (method_data.MethodBuilder, Location);
- return_attributes.ApplyAttributeBuilder (a, cb);
+ return_attributes.ApplyAttributeBuilder (a, cb, pa);
return;
}
- ApplyToExtraTarget (a, cb);
+ ApplyToExtraTarget (a, cb, pa);
}
- virtual protected void ApplyToExtraTarget (Attribute a, CustomAttributeBuilder cb)
+ protected virtual void ApplyToExtraTarget (Attribute a, CustomAttributeBuilder cb, PredefinedAttributes pa)
{
throw new NotSupportedException ("You forgot to define special attribute target handling");
}
{
method_data.Emit (parent);
-#if GMCS_SOURCE
if ((ModFlags & Modifiers.COMPILER_GENERATED) != 0 && !Parent.IsCompilerGenerated)
- method_data.MethodBuilder.SetCustomAttribute (TypeManager.GetCompilerGeneratedAttribute (Location));
+ PredefinedAttributes.Get.CompilerGenerated.EmitAttribute (method_data.MethodBuilder);
if (((ModFlags & Modifiers.DEBUGGER_HIDDEN) != 0))
- method_data.MethodBuilder.SetCustomAttribute (TypeManager.GetDebuggerHiddenAttribute (Location));
-#endif
+ PredefinedAttributes.Get.DebuggerHidden.EmitAttribute (method_data.MethodBuilder);
+
+ if (TypeManager.IsDynamicType (ReturnType)) {
+ return_attributes = new ReturnParameter (method_data.MethodBuilder, Location);
+ return_attributes.EmitPredefined (PredefinedAttributes.Get.Dynamic, Location);
+ }
+
if (OptAttributes != null)
OptAttributes.Emit ();
this.parameters = accessor.Parameters;
}
- protected override void ApplyToExtraTarget(Attribute a, CustomAttributeBuilder cb)
+ protected override void ApplyToExtraTarget (Attribute a, CustomAttributeBuilder cb, PredefinedAttributes pa)
{
if (a.Target == AttributeTargets.Parameter) {
if (param_attr == null)
param_attr = new ImplicitParameter (method_data.MethodBuilder);
- param_attr.ApplyAttributeBuilder (a, cb);
+ param_attr.ApplyAttributeBuilder (a, cb, pa);
return;
}
- base.ApplyAttributeBuilder (a, cb);
+ base.ApplyAttributeBuilder (a, cb, pa);
}
public override ParametersCompiled ParameterInfo {
public override MethodBuilder Define (DeclSpace parent)
{
- parameters.Resolve (ResolveContext);
+ parameters.Resolve (this);
base.Define (parent);
}
}
- public override void ApplyAttributeBuilder (Attribute a, CustomAttributeBuilder cb)
+ public override void ApplyAttributeBuilder (Attribute a, CustomAttributeBuilder cb, PredefinedAttributes pa)
{
if (a.IsInternalMethodImplAttribute) {
method.is_external_implementation = true;
}
- base.ApplyAttributeBuilder (a, cb);
+ base.ApplyAttributeBuilder (a, cb, pa);
}
public override AttributeTargets AttributeTargets {
this.define_set_first = define_set_first;
}
- public override void ApplyAttributeBuilder (Attribute a, CustomAttributeBuilder cb)
+ public override void ApplyAttributeBuilder (Attribute a, CustomAttributeBuilder cb, PredefinedAttributes pa)
{
if (a.HasSecurityAttribute) {
a.Error_InvalidSecurityParent ();
// case, we do not actually emit the ".property", so there is nowhere to
// put the attribute
//
- if (PropertyBuilder != null && OptAttributes != null)
- OptAttributes.Emit ();
+ if (PropertyBuilder != null) {
+ if (OptAttributes != null)
+ OptAttributes.Emit ();
+
+ if (TypeManager.IsDynamicType (member_type))
+ PredefinedAttributes.Get.Dynamic.EmitAttribute (PropertyBuilder);
+ }
if (!Get.IsDummy)
Get.Emit (Parent);
sealed class AddDelegateMethod: AEventPropertyAccessor
{
public AddDelegateMethod (Event method, Accessor accessor):
- base (method, accessor, "add_")
+ base (method, accessor, AddPrefix)
{
}
}
sealed class RemoveDelegateMethod: AEventPropertyAccessor
{
public RemoveDelegateMethod (Event method, Accessor accessor):
- base (method, accessor, "remove_")
+ base (method, accessor, RemovePrefix)
{
}
}
sealed class AddDelegateMethod: EventFieldAccessor
{
public AddDelegateMethod (Event method):
- base (method, "add_")
+ base (method, AddPrefix)
{
}
sealed class RemoveDelegateMethod: EventFieldAccessor
{
public RemoveDelegateMethod (Event method):
- base (method, "remove_")
+ base (method, RemovePrefix)
{
}
Remove = new RemoveDelegateMethod (this);
}
- public override void ApplyAttributeBuilder (Attribute a, CustomAttributeBuilder cb)
+ public override void ApplyAttributeBuilder (Attribute a, CustomAttributeBuilder cb, PredefinedAttributes pa)
{
if (a.Target == AttributeTargets.Field) {
- BackingField.ApplyAttributeBuilder (a, cb);
+ BackingField.ApplyAttributeBuilder (a, cb, pa);
return;
}
if (a.Target == AttributeTargets.Method) {
int errors = Report.Errors;
- Add.ApplyAttributeBuilder (a, cb);
+ Add.ApplyAttributeBuilder (a, cb, pa);
if (errors == Report.Errors)
- Remove.ApplyAttributeBuilder (a, cb);
+ Remove.ApplyAttributeBuilder (a, cb, pa);
return;
}
- base.ApplyAttributeBuilder (a, cb);
+ base.ApplyAttributeBuilder (a, cb, pa);
}
public override bool Define()
GetSignatureForError ());
}
- if (!HasBackingField)
+ if (!HasBackingField) {
+ SetMemberIsUsed ();
return true;
+ }
// FIXME: We are unable to detect whether generic event is used because
// we are using FieldExpr instead of EventExpr for event access in that
// case. When this issue will be fixed this hack can be removed.
if (TypeManager.IsGenericType (MemberType))
- SetMemberIsUsed();
+ SetMemberIsUsed ();
if (Add.IsInterfaceImplementation)
SetMemberIsUsed ();
static readonly string[] attribute_targets = new string [] { "method", "param", "return" };
+ public const string AddPrefix = "add_";
+ public const string RemovePrefix = "remove_";
+
protected AEventAccessor (Event method, string prefix)
: base (method, prefix)
{
get { return method_data.implementing != null; }
}
- public override void ApplyAttributeBuilder (Attribute a, CustomAttributeBuilder cb)
+ public override void ApplyAttributeBuilder (Attribute a, CustomAttributeBuilder cb, PredefinedAttributes pa)
{
if (a.IsInternalMethodImplAttribute) {
method.is_external_implementation = true;
}
- base.ApplyAttributeBuilder (a, cb);
+ base.ApplyAttributeBuilder (a, cb, pa);
}
- protected override void ApplyToExtraTarget(Attribute a, CustomAttributeBuilder cb)
+ protected override void ApplyToExtraTarget (Attribute a, CustomAttributeBuilder cb, PredefinedAttributes pa)
{
if (a.Target == AttributeTargets.Parameter) {
if (param_attr == null)
param_attr = new ImplicitParameter (method_data.MethodBuilder);
- param_attr.ApplyAttributeBuilder (a, cb);
+ param_attr.ApplyAttributeBuilder (a, cb, pa);
return;
}
- base.ApplyAttributeBuilder (a, cb);
+ base.ApplyAttributeBuilder (a, cb, pa);
}
public override AttributeTargets AttributeTargets {
{
}
- public override void ApplyAttributeBuilder (Attribute a, CustomAttributeBuilder cb)
+ public override void ApplyAttributeBuilder (Attribute a, CustomAttributeBuilder cb, PredefinedAttributes pa)
{
if ((a.HasSecurityAttribute)) {
a.Error_InvalidSecurityParent ();
public override MethodBuilder Define (DeclSpace parent)
{
- parameters.Resolve (ResolveContext);
+ parameters.Resolve (this);
return base.Define (parent);
}
if (!DefineParameters (parameters))
return false;
- if (OptAttributes != null && TypeManager.indexer_name_type != null) {
- Attribute indexer_attr = OptAttributes.Search (TypeManager.indexer_name_type);
+ if (OptAttributes != null) {
+ Attribute indexer_attr = OptAttributes.Search (PredefinedAttributes.Get.IndexerName);
if (indexer_attr != null) {
// Remove the attribute from the list because it is not emitted
OptAttributes.Attrs.Remove (indexer_attr);
Block = block;
}
- public override void ApplyAttributeBuilder (Attribute a, CustomAttributeBuilder cb)
+ public override void ApplyAttributeBuilder (Attribute a, CustomAttributeBuilder cb, PredefinedAttributes pa)
{
- if (a.Type == TypeManager.conditional_attribute_type) {
+ if (a.Type == pa.Conditional) {
Error_ConditionalAttributeIsNotValid ();
return;
}
- base.ApplyAttributeBuilder (a, cb);
+ base.ApplyAttributeBuilder (a, cb, pa);
}
public override bool Define ()
Type first_arg_type_unwrap = first_arg_type;
if (TypeManager.IsNullableType (first_arg_type))
- first_arg_type_unwrap = TypeManager.GetTypeArguments (first_arg_type) [0];
+ first_arg_type_unwrap = TypeManager.TypeToCoreType (TypeManager.GetTypeArguments (first_arg_type) [0]);
Type return_type_unwrap = return_type;
if (TypeManager.IsNullableType (return_type))
- return_type_unwrap = TypeManager.GetTypeArguments (return_type) [0];
+ return_type_unwrap = TypeManager.TypeToCoreType (TypeManager.GetTypeArguments (return_type) [0]);
+
+ if (TypeManager.IsDynamicType (return_type) || TypeManager.IsDynamicType (first_arg_type)) {
+ Report.Error (1964, Location,
+ "User-defined operator `{0}' cannot convert to or from the dynamic type",
+ GetSignatureForError ());
+
+ return false;
+ }
//
// Rules for conversion operators