Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 39 additions & 39 deletions src/System.Management.Automation/engine/parser/Parser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4370,49 +4370,49 @@ private MemberAst ClassMemberRule(string className, out List<Ast> astsOnError)
switch (token.Kind)
{
#if SUPPORT_PUBLIC_PRIVATE
case TokenKind.Public:
if (publicToken != null)
{
ReportError(token.Extent,
nameof(ParserStrings.DuplicateQualifier),
ParserStrings.DuplicateQualifier,
token.Text);
}
case TokenKind.Public:
if (publicToken != null)
{
ReportError(token.Extent,
nameof(ParserStrings.DuplicateQualifier),
ParserStrings.DuplicateQualifier,
token.Text);
}

if (privateToken != null)
{
ReportError(token.Extent,
nameof(ParserStrings.ModifiersCannotBeCombined),
ParserStrings.ModifiersCannotBeCombined,
privateToken.Text,
token.Text);
}
if (privateToken != null)
{
ReportError(token.Extent,
nameof(ParserStrings.ModifiersCannotBeCombined),
ParserStrings.ModifiersCannotBeCombined,
privateToken.Text,
token.Text);
}

publicToken = token;
SkipToken();
break;
publicToken = token;
SkipToken();
break;

case TokenKind.Private:
if (privateToken != null)
{
ReportError(token.Extent,
nameof(ParserStrings.DuplicateQualifier),
ParserStrings.DuplicateQualifier,
token.Text);
}
case TokenKind.Private:
if (privateToken != null)
{
ReportError(token.Extent,
nameof(ParserStrings.DuplicateQualifier),
ParserStrings.DuplicateQualifier,
token.Text);
}

if (publicToken != null)
{
ReportError(token.Extent,
nameof(ParserStrings.ModifiersCannotBeCombined),
ParserStrings.ModifiersCannotBeCombined,
publicToken.Text,
token.Text);
}
if (publicToken != null)
{
ReportError(token.Extent,
nameof(ParserStrings.ModifiersCannotBeCombined),
ParserStrings.ModifiersCannotBeCombined,
publicToken.Text,
token.Text);
}

privateToken = token;
SkipToken();
break;
privateToken = token;
SkipToken();
break;
#endif

case TokenKind.Hidden:
Expand Down Expand Up @@ -4529,7 +4529,7 @@ private MemberAst ClassMemberRule(string className, out List<Ast> astsOnError)
return null;
}

#if FALSE
#if SUPPORT_PUBLIC_PRIVATE
MethodAttributes attributes = privateToken != null ? MethodAttributes.Private : MethodAttributes.Public;
#else
MethodAttributes attributes = MethodAttributes.Public;
Expand Down
14 changes: 3 additions & 11 deletions src/System.Management.Automation/engine/runtime/Binding/Binders.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ internal static DynamicMetaObject WriteToDebugLog(this DynamicMetaObject obj, Dy

internal static BindingRestrictions GetSimpleTypeRestriction(this DynamicMetaObject obj)
{
if (obj.Value == null || ClrFacade.IsTransparentProxy(obj.Value))
if (obj.Value == null)
{
return BindingRestrictions.GetInstanceRestriction(obj.Expression, obj.Value);
}
Expand Down Expand Up @@ -132,7 +132,7 @@ internal static BindingRestrictions PSGetStaticMemberRestriction(this DynamicMet
return obj.Restrictions;
}

if (obj.Value == null || ClrFacade.IsTransparentProxy(obj.Value))
if (obj.Value == null)
{
return BindingRestrictions.GetInstanceRestriction(obj.Expression, obj.Value);
}
Expand Down Expand Up @@ -187,7 +187,7 @@ internal static BindingRestrictions PSGetTypeRestriction(this DynamicMetaObject
return obj.Restrictions;
}

if (obj.Value == null || ClrFacade.IsTransparentProxy(obj.Value))
if (obj.Value == null)
{
return BindingRestrictions.GetInstanceRestriction(obj.Expression, obj.Value);
}
Expand Down Expand Up @@ -6878,14 +6878,6 @@ internal static DynamicMetaObject InvokeDotNetMethod(
argValues[i] = arg == AutomationNull.Value ? null : arg;
}

if (ClrFacade.IsTransparentProxy(target.Value) && (psMethodInvocationConstraints == null || psMethodInvocationConstraints.MethodTargetType == null))
{
var argTypes = (psMethodInvocationConstraints == null)
? new Type[numArgs]
: psMethodInvocationConstraints.ParameterTypes.ToArray();
psMethodInvocationConstraints = new PSMethodInvocationConstraints(target.Value.GetType(), argTypes);
}

var result = Adapter.FindBestMethod(
mi,
psMethodInvocationConstraints,
Expand Down
13 changes: 0 additions & 13 deletions src/System.Management.Automation/utils/ClrFacade.cs
Original file line number Diff line number Diff line change
Expand Up @@ -280,19 +280,6 @@ private static SecurityZone ReadFromZoneIdentifierDataStream(string filePath)

#region Misc

/// <summary>
/// Facade for RemotingServices.IsTransparentProxy(object)
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static bool IsTransparentProxy(object obj)
{
#if CORECLR // Namespace System.Runtime.Remoting is not in CoreCLR
return false;
#else
return System.Runtime.Remoting.RemotingServices.IsTransparentProxy(obj);
#endif
}

/// <summary>
/// Facade for ManagementDateTimeConverter.ToDmtfDateTime(DateTime)
/// </summary>
Expand Down