提交 b9a6219c 编写于 作者: A Alireza Habibi 提交者: Julien Couvreur

Remove dead code (#19320)

Merging on behalf of @alrz. 
上级 5dff94f3
......@@ -960,11 +960,6 @@ private SourceLocalSymbol LocateDeclaredVariableSymbol(VariableDeclaratorSyntax
return LocateDeclaredVariableSymbol(declarator.Identifier, typeSyntax, declarator.Initializer);
}
private SourceLocalSymbol LocateDeclaredVariableSymbol(SingleVariableDesignationSyntax designation, TypeSyntax typeSyntax)
{
return LocateDeclaredVariableSymbol(designation.Identifier, typeSyntax, null);
}
private SourceLocalSymbol LocateDeclaredVariableSymbol(SyntaxToken identifier, TypeSyntax typeSyntax, EqualsValueClauseSyntax equalsValue)
{
SourceLocalSymbol localSymbol = this.LookupLocal(identifier);
......
......@@ -1431,22 +1431,6 @@ public static bool IsValidExtensionMethodThisArgConversion(Conversion conversion
}
}
private enum NumericType
{
SByte,
Byte,
Short,
UShort,
Int,
UInt,
Long,
ULong,
Char,
Float,
Double,
Decimal
}
private const bool F = false;
private const bool T = true;
......
......@@ -90,16 +90,6 @@ public MemberResolutionResult<TMember> BestResult
}
}
private bool HasBestResult
{
get
{
EnsureBestResultLoaded();
return _bestResultState.Value();
}
}
/// <summary>
/// Returns information about each method that was considered during overload resolution,
/// and what the results of overload resolution were for that method.
......
......@@ -380,11 +380,6 @@ private static MethodSymbol DelegateInvokeMethod(NamedTypeSymbol delegateType)
return delegateType.GetDelegateType()?.DelegateInvokeMethod;
}
private static ImmutableArray<ParameterSymbol> DelegateParameters(MethodSymbol invokeMethod)
{
return ((object)invokeMethod == null) ? ImmutableArray<ParameterSymbol>.Empty : invokeMethod.Parameters;
}
private static TypeSymbol DelegateReturnType(MethodSymbol invokeMethod, out RefKind refKind)
{
if ((object)invokeMethod == null)
......
......@@ -1560,18 +1560,6 @@ protected override void VisitPatternSwitchSection(BoundPatternSwitchSection node
base.VisitPatternSwitchSection(node, switchExpression, isLastSection);
}
private void CreateSlots(BoundPattern pattern)
{
if (pattern.Kind == BoundKind.DeclarationPattern)
{
var local = ((BoundDeclarationPattern)pattern).Variable as LocalSymbol;
if ((object)local != null)
{
int slot = GetOrCreateSlot(local);
}
}
}
public override BoundNode VisitForStatement(BoundForStatement node)
{
DeclareVariables(node.OuterLocals);
......
......@@ -803,11 +803,6 @@ protected virtual void ResolveBranch(PendingBranch pending, LabelSymbol label, B
}
}
private bool ResolveBranches(BoundLabeledStatement target)
{
return ResolveBranches(target.Label, target);
}
protected struct SavedPending
{
public readonly ArrayBuilder<PendingBranch> PendingBranches;
......
......@@ -32,16 +32,6 @@ internal static IEnumerable<Symbol> Analyze(CSharpCompilation compilation, Symbo
private HashSet<Symbol> _variablesDeclared = new HashSet<Symbol>();
private void Analyze()
{
// only one pass needed.
regionPlace = RegionPlace.Before;
bool badRegion = false;
SetState(ReachableState());
Scan(ref badRegion);
if (badRegion) _variablesDeclared.Clear();
}
internal VariablesDeclaredWalker(CSharpCompilation compilation, Symbol member, BoundNode node, BoundNode firstInRegion, BoundNode lastInRegion)
: base(compilation, member, node, firstInRegion, lastInRegion)
{
......
......@@ -100,14 +100,6 @@ private BoundExpression MakeIsDeclarationPattern(BoundDeclarationPattern lowered
return MakeIsDeclarationPattern(loweredPattern.Syntax, loweredInput, loweredPattern.VariableAccess, requiresNullTest: loweredInput.Type.CanContainNull());
}
/// <summary>
/// Produce a 'logical and' operation that is clearly irrefutable (<see cref="IsIrrefutablePatternTest(BoundExpression)"/>) when it can be.
/// </summary>
BoundExpression LogicalAndForPatterns(BoundExpression left, BoundExpression right)
{
return IsIrrefutablePatternTest(left) ? _factory.MakeSequence(left, right) : _factory.LogicalAnd(left, right);
}
/// <summary>
/// Is the test, produced as a result of a pattern-matching operation, always true?
/// Knowing that enables us to construct slightly more efficient code.
......
......@@ -42,43 +42,6 @@ internal partial class LanguageParser : SyntaxParser
_syntaxFactory = new ContextAwareSyntax(_syntaxFactoryContext);
}
// Special Name checks
private static bool IsName(CSharpSyntaxNode node, SyntaxKind kind)
{
if (node.Kind == SyntaxKind.IdentifierToken)
{
return ((SyntaxToken)node).ContextualKind == kind;
}
else if (node.Kind == SyntaxKind.IdentifierName)
{
return ((IdentifierNameSyntax)node).Identifier.ContextualKind == kind;
}
else
{
return node.ToString() == SyntaxFacts.GetText(kind);
}
}
private static bool IsNameGet(CSharpSyntaxNode node)
{
return IsName(node, SyntaxKind.GetKeyword);
}
private static bool IsNameSet(CSharpSyntaxNode node)
{
return IsName(node, SyntaxKind.SetKeyword);
}
private static bool IsNameAdd(CSharpSyntaxNode node)
{
return IsName(node, SyntaxKind.AddKeyword);
}
private static bool IsNameRemove(CSharpSyntaxNode node)
{
return IsName(node, SyntaxKind.RemoveKeyword);
}
private static bool IsSomeWord(SyntaxKind kind)
{
return kind == SyntaxKind.IdentifierToken || SyntaxFacts.IsKeywordKind(kind);
......@@ -9689,29 +9652,6 @@ private ArgumentSyntax ParseArgumentExpression(bool isIndexer)
return _syntaxFactory.Argument(nameColon, refOrOutKeyword, expression);
}
private bool IsPossibleOutVarDeclaration()
{
var tk = this.CurrentToken.Kind;
if (SyntaxFacts.IsPredefinedType(tk) && this.PeekToken(1).Kind != SyntaxKind.DotToken)
{
return true;
}
var resetPoint = this.GetResetPoint();
try
{
SyntaxToken lastTokenOfType;
ScanTypeFlags st = this.ScanType(out lastTokenOfType);
return st != ScanTypeFlags.NotType && this.IsTrueIdentifier();
}
finally
{
this.Reset(ref resetPoint);
this.Release(ref resetPoint);
}
}
private TypeOfExpressionSyntax ParseTypeOfExpression()
{
var keyword = this.EatToken();
......
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Diagnostics;
using System.Globalization;
using System.Text;
using PooledStringBuilder = Microsoft.CodeAnalysis.Collections.PooledStringBuilder;
......@@ -133,20 +132,6 @@ internal static string FormatLiteral(bool value)
return value ? "true" : "false";
}
private static bool TryReplaceQuote(char c, char quote, out string replaceWith)
{
Debug.Assert(quote == '"' || quote == '\'');
if (c == quote)
{
replaceWith = "\\" + c;
return true;
}
replaceWith = null;
return false;
}
/// <summary>
/// Returns true if the character should be replaced and sets
/// <paramref name="replaceWith"/> to the replacement text.
......
......@@ -795,24 +795,6 @@ private bool IsValidExtensionMethodSignature()
this.ParameterRefKinds.IsDefault && // No 'ref' or 'out'
!this.IsParams();
private bool IsValidUserDefinedOperatorIs()
{
foreach (var parameter in this.Parameters)
{
if (parameter.RefKind != ((parameter.Ordinal == 0) ? RefKind.None : RefKind.Out))
{
return false;
}
}
return
(this.ReturnsVoid || this.ReturnType.SpecialType == SpecialType.System_Boolean) &&
!this.IsGenericMethod &&
!this.IsVararg &&
this.ParameterCount > 0 &&
!this.IsParams();
}
private MethodKind ComputeMethodKind()
{
if (this.HasSpecialName)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册