Skip to content

Commit

Permalink
Delete finally blocks in EcmaSignatureParser (#85577)
Browse files Browse the repository at this point in the history
These lightweight structs are not meant to be reusable.
  • Loading branch information
MichalStrehovsky authored May 1, 2023
1 parent e56ff52 commit 0c419b0
Showing 1 changed file with 11 additions and 28 deletions.
39 changes: 11 additions & 28 deletions src/coreclr/tools/Common/TypeSystem/Ecma/EcmaSignatureParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -327,19 +327,10 @@ public bool IsFieldSignature

public MethodSignature ParseMethodSignature()
{
try
{
_indexStack = new Stack<int>();
_indexStack.Push(0);
_embeddedSignatureDataList = new List<EmbeddedSignatureData>();
return ParseMethodSignatureInternal(skipEmbeddedSignatureData: false);
}
finally
{
_indexStack = null;
_embeddedSignatureDataList = null;
}

_indexStack = new Stack<int>();
_indexStack.Push(0);
_embeddedSignatureDataList = new List<EmbeddedSignatureData>();
return ParseMethodSignatureInternal(skipEmbeddedSignatureData: false);
}

private MethodSignature ParseMethodSignatureInternal(bool skipEmbeddedSignatureData)
Expand Down Expand Up @@ -473,21 +464,13 @@ public TypeDesc ParseFieldSignature()

public TypeDesc ParseFieldSignature(out EmbeddedSignatureData[] embeddedSigData)
{
try
{
_indexStack = new Stack<int>();
_indexStack.Push(1);
_indexStack.Push(0);
_embeddedSignatureDataList = new List<EmbeddedSignatureData>();
TypeDesc parsedType = ParseFieldSignature();
embeddedSigData = _embeddedSignatureDataList.Count == 0 ? null : _embeddedSignatureDataList.ToArray();
return parsedType;
}
finally
{
_indexStack = null;
_embeddedSignatureDataList = null;
}
_indexStack = new Stack<int>();
_indexStack.Push(1);
_indexStack.Push(0);
_embeddedSignatureDataList = new List<EmbeddedSignatureData>();
TypeDesc parsedType = ParseFieldSignature();
embeddedSigData = _embeddedSignatureDataList.Count == 0 ? null : _embeddedSignatureDataList.ToArray();
return parsedType;
}

public LocalVariableDefinition[] ParseLocalsSignature()
Expand Down

0 comments on commit 0c419b0

Please sign in to comment.