diff options
author | Gergely Kalapos <gergo@kalapos.net> | 2017-05-17 00:16:52 +0300 |
---|---|---|
committer | Jan Kotas <jkotas@microsoft.com> | 2017-05-17 00:16:52 +0300 |
commit | 553e70def758f3baf28a2b05542f48c18c5b0463 (patch) | |
tree | 15290fcdeef5c476356c8932d197b78254839c52 /src | |
parent | 3004f6d4fdb9cde9c3b57f06f22f8cd89a3c5277 (diff) |
Implemented ImportEndFilter() (#3628)
Diffstat (limited to 'src')
-rw-r--r-- | src/ILVerify/src/ILImporter.Verify.cs | 7 | ||||
-rw-r--r-- | src/ILVerify/src/Resources/Strings.resx | 6 | ||||
-rw-r--r-- | src/ILVerify/src/VerifierError.cs | 4 |
3 files changed, 14 insertions, 3 deletions
diff --git a/src/ILVerify/src/ILImporter.Verify.cs b/src/ILVerify/src/ILImporter.Verify.cs index 0abc48d89..ad7a43c14 100644 --- a/src/ILVerify/src/ILImporter.Verify.cs +++ b/src/ILVerify/src/ILImporter.Verify.cs @@ -1583,7 +1583,12 @@ namespace Internal.IL void ImportEndFilter() { - // TODO: + Check(_currentBasicBlock.FilterIndex.HasValue, VerifierError.Endfilter); + Check(_currentOffset == _exceptionRegions[_currentBasicBlock.FilterIndex.Value].ILRegion.HandlerOffset, VerifierError.Endfilter); + + var result = Pop(); + Check(result.Kind == StackValueKind.Int32, VerifierError.StackUnexpected); + Check(_stackTop == 0, VerifierError.EndfilterStack); } void ImportCpBlk() diff --git a/src/ILVerify/src/Resources/Strings.resx b/src/ILVerify/src/Resources/Strings.resx index 0800832e1..76b717caa 100644 --- a/src/ILVerify/src/Resources/Strings.resx +++ b/src/ILVerify/src/Resources/Strings.resx @@ -135,6 +135,12 @@ <data name="ConstrainedCallWithNonByRefThis" xml:space="preserve"> <value>The 'this' argument to a constrained call must have ByRef type.</value> </data> + <data name="Endfilter" xml:space="preserve"> + <value>Endfilter from outside an exception filter block.</value> + </data> + <data name="EndfilterStack" xml:space="preserve"> + <value>Stack not empty when leaving an exception filter.</value> + </data> <data name="ExpectedArray" xml:space="preserve"> <value>Expected single-dimension zero-based array.</value> </data> diff --git a/src/ILVerify/src/VerifierError.cs b/src/ILVerify/src/VerifierError.cs index b803b1c8d..37524b6f3 100644 --- a/src/ILVerify/src/VerifierError.cs +++ b/src/ILVerify/src/VerifierError.cs @@ -61,7 +61,7 @@ namespace ILVerify //E_LEAVE "Leave from outside a try or catch block." Rethrow, //"Rethrow from outside a catch handler." //E_ENDFINALLY "Endfinally from outside a finally handler." - //E_ENDFILTER "Endfilter from outside an exception filter block." + Endfilter, //"Endfilter from outside an exception filter block." //E_ENDFILTER_MISSING "Missing Endfilter." //E_BR_INTO_TRY "Branch into try block." //E_BR_INTO_HND "Branch into exception handler block." @@ -186,7 +186,7 @@ namespace ILVerify //E_BOX_PTR_TO_STACK "Box operation on TypedReference, ArgHandle, or ArgIterator." //E_SIG_BYREF_TB_AH "ByRef of TypedReference, ArgHandle, or ArgIterator." //E_SIG_ARRAY_TB_AH "Array of TypedReference, ArgHandle, or ArgIterator." - //E_ENDFILTER_STACK "Stack not empty when leaving an exception filter." + EndfilterStack, //"Stack not empty when leaving an exception filter." //E_DLGT_SIG_I "Unrecognized delegate .ctor signature; expected I." //E_DLGT_SIG_O "Unrecognized delegate .ctor signature; expected Object." //E_RA_PTR_TO_STACK "Mkrefany on TypedReference, ArgHandle, or ArgIterator." |