Skip to content

Simplify the simplification code.#59864

Merged
CyrusNajmabadi merged 3 commits intodotnet:mainfrom
CyrusNajmabadi:reductionTest2
Mar 3, 2022
Merged

Simplify the simplification code.#59864
CyrusNajmabadi merged 3 commits intodotnet:mainfrom
CyrusNajmabadi:reductionTest2

Conversation

@CyrusNajmabadi
Copy link
Copy Markdown
Contributor

No description provided.

@ghost ghost added the Area-IDE label Mar 1, 2022
@CyrusNajmabadi CyrusNajmabadi changed the title Testing to see what this breaks (1) Simplify the simplification code. Mar 2, 2022
@CyrusNajmabadi CyrusNajmabadi requested a review from akhera99 March 2, 2022 02:33
public readonly SyntaxNodeOrToken NodeOrToken;
public readonly bool SimplifyAllDescendants;
public readonly SyntaxNodeOrToken OriginalNodeOrToken;
public readonly bool CanBeSpeculated;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

canbespeculated was never used. removed.

private readonly Func<SyntaxNodeOrToken, bool> _isNodeOrTokenOutsideSimplifySpans;

private static readonly Func<SyntaxNode, bool> s_containsAnnotations = n => n.ContainsAnnotations;
private static readonly Func<SyntaxNodeOrToken, bool> s_hasSimplifierAnnotation = n => n.HasAnnotation(Simplifier.Annotation);
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved up and shared between c# and vb.

protected static readonly Func<SyntaxNode, bool> s_containsAnnotations = n => n.ContainsAnnotations;
protected static readonly Func<SyntaxNodeOrToken, bool> s_hasSimplifierAnnotation = n => n.HasAnnotation(Simplifier.Annotation);

private readonly ImmutableArray<AbstractReducer> _reducers;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

made readonly.

Return VisitMethodBlockBaseSyntax(node,
Function(n, b, s, e)
Return DirectCast(n, MethodBlockSyntax).Update(node.Kind, DirectCast(b, MethodStatementSyntax), s, e)
End Function
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

inlined lambdas.

@CyrusNajmabadi CyrusNajmabadi marked this pull request as ready for review March 2, 2022 02:34
@CyrusNajmabadi CyrusNajmabadi requested a review from a team as a code owner March 2, 2022 02:34
IsNodeVariableDeclaratorOfFieldDeclaration(node) AndAlso
Me._simplifyAllDescendants Then
Me._nodesAndTokensToReduce.Add(New NodeOrTokenToReduce(node, False, node, False))
Me._nodesAndTokensToReduce.Add(New NodeOrTokenToReduce(node, False, node))
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that last parameter was passed, but never read. removed.

@CyrusNajmabadi CyrusNajmabadi merged commit 01a78b9 into dotnet:main Mar 3, 2022
@ghost ghost added this to the Next milestone Mar 3, 2022
@CyrusNajmabadi CyrusNajmabadi deleted the reductionTest2 branch March 3, 2022 07:23
@allisonchou allisonchou modified the milestones: Next, 17.2.P3 Mar 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants