summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Kotas <jkotas@microsoft.com>2016-12-21 12:49:34 -0800
committerGitHub <noreply@github.com>2016-12-21 12:49:34 -0800
commit3f9ec2a41a809ae6e39e727871d1d7d6c29106b7 (patch)
treea39945c30efefe3f538f44b8cb4f37bf08ef612c
parent426e4da54f3b79b381f0d5deb11cdc32ffeb4f4d (diff)
downloadcoreclr-3f9ec2a41a809ae6e39e727871d1d7d6c29106b7.tar.gz
coreclr-3f9ec2a41a809ae6e39e727871d1d7d6c29106b7.tar.bz2
coreclr-3f9ec2a41a809ae6e39e727871d1d7d6c29106b7.zip
Move EditorBrowsableAttribute to CoreLib (#8703)
-rw-r--r--src/mscorlib/model.xml11
-rw-r--r--src/mscorlib/mscorlib.shared.sources.props4
-rw-r--r--src/mscorlib/src/System/Collections/DictionaryEntry.cs3
-rw-r--r--src/mscorlib/src/System/Collections/Generic/KeyValuePair.cs3
-rw-r--r--src/mscorlib/src/System/ComponentModel/EditorBrowsableAttribute.cs48
-rw-r--r--src/mscorlib/src/System/ReadOnlySpan.cs3
-rw-r--r--src/mscorlib/src/System/Span.cs3
7 files changed, 73 insertions, 2 deletions
diff --git a/src/mscorlib/model.xml b/src/mscorlib/model.xml
index c0e9746306..5e2d061cd9 100644
--- a/src/mscorlib/model.xml
+++ b/src/mscorlib/model.xml
@@ -12482,5 +12482,16 @@
<Member Name="Slice(System.String,System.Int32)" />
<Member Name="Slice(System.String,System.Int32,System.Int32)" />
</Type>
+ <Type Name="System.ComponentModel.EditorBrowsableAttribute">
+ <Member Name="#ctor" />
+ <Member Name="#ctor(System.ComponentModel.EditorBrowsableState)" />
+ <Member Name="get_State" />
+ <Member MemberType="Property" Name="State" />
+ </Type>
+ <Type Name="System.ComponentModel.EditorBrowsableState">
+ <Member MemberType="Field" Name="Always" />
+ <Member MemberType="Field" Name="Never" />
+ <Member MemberType="Field" Name="Advanced" />
+ </Type>
</Assembly>
</ThinModel>
diff --git a/src/mscorlib/mscorlib.shared.sources.props b/src/mscorlib/mscorlib.shared.sources.props
index 3c4b1bce4a..e7328de5a8 100644
--- a/src/mscorlib/mscorlib.shared.sources.props
+++ b/src/mscorlib/mscorlib.shared.sources.props
@@ -84,6 +84,9 @@
<CollectionsSources Include="$(BclSourcesRoot)\System\Collections\StructuralComparisons.cs" />
</ItemGroup>
<ItemGroup>
+ <ComponentModelSources Include="$(BclSourcesRoot)\System\ComponentModel\EditorBrowsableAttribute.cs" />
+ </ItemGroup>
+ <ItemGroup>
<InteropSources Include="$(BclSourcesRoot)\System\Runtime\InteropServices\ArrayWithOffset.cs" />
<InteropSources Include="$(BclSourcesRoot)\System\Runtime\InteropServices\Attributes.cs" />
<InteropSources Include="$(BclSourcesRoot)\System\Runtime\InteropServices\CallingConvention.cs" />
@@ -1262,6 +1265,7 @@
<MscorlibSources Include="@(ThreadingSources)"/>
<MscorlibSources Include="@(DeploymentSources)"/>
<MscorlibSources Include="@(CollectionsSources)"/>
+ <MscorlibSources Include="@(ComponentModelSources)"/>
<MscorlibSources Include="@(GenericsSources)"/>
<MscorlibSources Include="@(DiagnosticsSources)"/>
<MscorlibSources Include="@(DiagnosticsCodeanalysisSources)"/>
diff --git a/src/mscorlib/src/System/Collections/DictionaryEntry.cs b/src/mscorlib/src/System/Collections/DictionaryEntry.cs
index 3ee392bb0d..ac505c1e13 100644
--- a/src/mscorlib/src/System/Collections/DictionaryEntry.cs
+++ b/src/mscorlib/src/System/Collections/DictionaryEntry.cs
@@ -16,6 +16,7 @@
namespace System.Collections {
using System;
+ using System.ComponentModel;
// A DictionaryEntry holds a key and a value from a dictionary.
// It is returned by IDictionaryEnumerator::GetEntry().
[System.Runtime.InteropServices.ComVisible(true)]
@@ -52,7 +53,7 @@ namespace System.Collections {
}
}
- // BLOCKED (do not add now): [EditorBrowsable(EditorBrowsableState.Never)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
public void Deconstruct(out object key, out object value)
{
key = Key;
diff --git a/src/mscorlib/src/System/Collections/Generic/KeyValuePair.cs b/src/mscorlib/src/System/Collections/Generic/KeyValuePair.cs
index ad9f7472aa..ba98adad7d 100644
--- a/src/mscorlib/src/System/Collections/Generic/KeyValuePair.cs
+++ b/src/mscorlib/src/System/Collections/Generic/KeyValuePair.cs
@@ -16,6 +16,7 @@
namespace System.Collections.Generic {
using System;
+ using System.ComponentModel;
using System.Text;
// Provides the Create factory method for KeyValuePair<TKey, TValue>.
@@ -63,7 +64,7 @@ namespace System.Collections.Generic {
return StringBuilderCache.GetStringAndRelease(s);
}
- // BLOCKED (do not add now): [EditorBrowsable(EditorBrowsableState.Never)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
public void Deconstruct(out TKey key, out TValue value)
{
key = Key;
diff --git a/src/mscorlib/src/System/ComponentModel/EditorBrowsableAttribute.cs b/src/mscorlib/src/System/ComponentModel/EditorBrowsableAttribute.cs
new file mode 100644
index 0000000000..a7946f8203
--- /dev/null
+++ b/src/mscorlib/src/System/ComponentModel/EditorBrowsableAttribute.cs
@@ -0,0 +1,48 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.ComponentModel
+{
+ [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Delegate | AttributeTargets.Interface)]
+ public sealed class EditorBrowsableAttribute : Attribute
+ {
+ private EditorBrowsableState browsableState;
+
+ public EditorBrowsableAttribute(EditorBrowsableState state)
+ {
+ browsableState = state;
+ }
+
+ public EditorBrowsableAttribute () : this(EditorBrowsableState.Always) { }
+
+ public EditorBrowsableState State
+ {
+ get { return browsableState; }
+ }
+
+ public override bool Equals(object obj)
+ {
+ if (obj == this)
+ {
+ return true;
+ }
+
+ EditorBrowsableAttribute other = obj as EditorBrowsableAttribute;
+
+ return (other != null) && other.browsableState == browsableState;
+ }
+
+ public override int GetHashCode()
+ {
+ return base.GetHashCode();
+ }
+ }
+
+ public enum EditorBrowsableState
+ {
+ Always,
+ Never,
+ Advanced
+ }
+}
diff --git a/src/mscorlib/src/System/ReadOnlySpan.cs b/src/mscorlib/src/System/ReadOnlySpan.cs
index b0919d3208..83b212304c 100644
--- a/src/mscorlib/src/System/ReadOnlySpan.cs
+++ b/src/mscorlib/src/System/ReadOnlySpan.cs
@@ -3,6 +3,7 @@
// See the LICENSE file in the project root for more information.
using System.Collections.Generic;
+using System.ComponentModel;
using System.Diagnostics;
using System.Runtime.CompilerServices;
@@ -133,6 +134,7 @@ namespace System
/// </exception>
/// </summary>
[Obsolete("Equals() on Span will always throw an exception. Use == instead.")]
+ [EditorBrowsable(EditorBrowsableState.Never)]
public override bool Equals(object obj)
{
ThrowHelper.ThrowNotSupportedException_CannotCallEqualsOnSpan();
@@ -147,6 +149,7 @@ namespace System
/// </exception>
/// </summary>
[Obsolete("GetHashCode() on Span will always throw an exception.")]
+ [EditorBrowsable(EditorBrowsableState.Never)]
public override int GetHashCode()
{
ThrowHelper.ThrowNotSupportedException_CannotCallGetHashCodeOnSpan();
diff --git a/src/mscorlib/src/System/Span.cs b/src/mscorlib/src/System/Span.cs
index 9fa55c63d7..d7f8dc5c85 100644
--- a/src/mscorlib/src/System/Span.cs
+++ b/src/mscorlib/src/System/Span.cs
@@ -3,6 +3,7 @@
// See the LICENSE file in the project root for more information.
using System.Collections.Generic;
+using System.ComponentModel;
using System.Diagnostics;
using System.Runtime.CompilerServices;
@@ -254,6 +255,7 @@ namespace System
/// </exception>
/// </summary>
[Obsolete("Equals() on Span will always throw an exception. Use == instead.")]
+ [EditorBrowsable(EditorBrowsableState.Never)]
public override bool Equals(object obj)
{
ThrowHelper.ThrowNotSupportedException_CannotCallEqualsOnSpan();
@@ -268,6 +270,7 @@ namespace System
/// </exception>
/// </summary>
[Obsolete("GetHashCode() on Span will always throw an exception.")]
+ [EditorBrowsable(EditorBrowsableState.Never)]
public override int GetHashCode()
{
ThrowHelper.ThrowNotSupportedException_CannotCallGetHashCodeOnSpan();