public override bool Equals(object other) { if (other is FormulaType t) { return(_type.Equals(t._type)); } return(false); }
private void ApplySpecialAttributes(Analyzer /*!*/ analyzer) { if (type.Equals(SpecialCustomAttribute.AppStaticAttribute)) { Debug.Assert(node.CallSignature.Parameters.Empty(), "Should be checked by ResolveOverload"); ApplySpecialAttribute(analyzer, SpecialAttributes.AppStatic, null); isEmitted = false; } else if (type.Equals(SpecialCustomAttribute.ExportAttribute)) { Debug.Assert(node.CallSignature.Parameters.Empty(), "Should be checked by ResolveOverload"); if (!analyzer.SourceUnit.CompilationUnit.IsPure) { analyzer.ErrorSink.Add(Errors.ExportAttributeInNonPureUnit, analyzer.SourceUnit, node.Span); } else { ApplySpecialAttribute(analyzer, SpecialAttributes.Export, Core.ExportAttribute.Default); } isEmitted = false; } else if (type.Equals(SpecialCustomAttribute.OutAttribute)) { Debug.Assert(node.CallSignature.Parameters.Empty(), "Should be checked by ResolveOverload"); ApplySpecialAttribute(analyzer, SpecialAttributes.Out, new System.Runtime.InteropServices.OutAttribute()); isEmitted = true; } else if (type.Equals(SpecialCustomAttribute.DllImportAttribute)) { isEmitted = false; } else if (ReferenceEquals(type.TypeDesc, DTypeDesc.AttributeUsageAttributeTypeDesc)) { // set usage of the attribute defined by this attribute's target // Debug.Assert(node.CallSignature.Parameters.Empty(), "Missing arguments should be checked by ResolveOverload"); int valid_on = Convert.ObjectToInteger(node.CallSignature.Parameters[0].Expression.GetValue()); AttributeUsageAttribute usage = new AttributeUsageAttribute((AttributeTargets)valid_on); foreach (NamedActualParam param in node.NamedParameters) { if (param.Name.Equals("AllowMultiple")) { usage.AllowMultiple = Convert.ObjectToBoolean(param.Expression.GetValue()); } else if (param.Name.Equals("Inherited")) { usage.Inherited = Convert.ObjectToBoolean(param.Expression.GetValue()); } } ApplySpecialAttribute(analyzer, SpecialAttributes.AttributeUsage, usage); isEmitted = true; } else { isEmitted = true; } }