Skip to content

Commit

Permalink
Clean up method body encoding APIs (dotnet#10386)
Browse files Browse the repository at this point in the history
  • Loading branch information
tmat authored Jul 30, 2016
1 parent fc93489 commit 9b04bcb
Show file tree
Hide file tree
Showing 20 changed files with 2,607 additions and 817 deletions.
19 changes: 17 additions & 2 deletions src/System.Reflection.Metadata/src/Resources/Strings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,9 @@
<data name="TooManySubnamespaces" xml:space="preserve">
<value>There are too many subnamespaces.</value>
</data>
<data name="TooManyExceptionRegions" xml:space="preserve">
<value>There are too many exception regions.</value>
</data>
<data name="SequencePointValueOutOfRange" xml:space="preserve">
<value>Sequence point value is out of range.</value>
</data>
Expand Down Expand Up @@ -393,8 +396,8 @@
<data name="LabelDoesntBelongToBuilder" xml:space="preserve">
<value>Specified label doesn't belong to the current builder.</value>
</data>
<data name="BranchBuilderNotAvailable" xml:space="preserve">
<value>Can't emit a branch, the current encoder not created with a branch builder.</value>
<data name="ControlFlowBuilderNotAvailable" xml:space="preserve">
<value>Can't emit a branch or exception region, the current encoder not created with a control flow builder.</value>
</data>
<data name="BaseReaderMustBeFullMetadataReader" xml:space="preserve">
<value>Base reader must be a full metadata reader.</value>
Expand Down Expand Up @@ -456,4 +459,16 @@
<data name="UnsupportedFormatVersion" xml:space="preserve">
<value>Unsupported format version: {0}</value>
</data>
<data name="DistanceBetweenInstructionAndLabelTooBig" xml:space="preserve">
<value>The distance between the instruction {0} (offset {1}) and the target label doesn't fit the operand size: {2}</value>
</data>
<data name="LabelNotMarked" xml:space="preserve">
<value>Label {0} has not been marked.</value>
</data>
<data name="MethodHasNoExceptionRegions" xml:space="preserve">
<value>Method body was created with no exception regions.</value>
</data>
<data name="InvalidExceptionRegionBounds" xml:space="preserve">
<value>Invalid exception region bounds: start offset ({0}) is greater than end offset ({1}).</value>
</data>
</root>
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<ItemGroup>
<Compile Include="System\Reflection\Internal\Utilities\ExceptionUtilities.cs" />
<Compile Include="System\Reflection\Metadata\Ecma335\Encoding\FunctionPointerAttributes.cs" />
<Compile Include="System\Reflection\Metadata\Ecma335\Encoding\MethodBodiesEncoder.cs" />
<Compile Include="System\Reflection\Metadata\Ecma335\Encoding\MethodBodyStreamEncoder.cs" />
<Compile Include="System\Reflection\Metadata\Ecma335\Encoding\MethodBodyAttributes.cs" />
<Compile Include="System\Reflection\Metadata\Ecma335\MetadataBuilder.cs" />
<Compile Include="System\Reflection\Metadata\Ecma335\MetadataRootBuilder.cs" />
Expand All @@ -61,7 +61,7 @@
<Compile Include="System\Reflection\Metadata\Signatures\CustomAttributeTypedArgument.cs" />
<Compile Include="System\Reflection\Metadata\Signatures\CustomAttributeValue.cs" />
<Compile Include="System\Reflection\Metadata\Decoding\ICustomAttributeTypeProvider.cs" />
<Compile Include="System\Reflection\Metadata\Ecma335\Encoding\BranchBuilder.cs" />
<Compile Include="System\Reflection\Metadata\Ecma335\Encoding\ControlFlowBuilder.cs" />
<Compile Include="System\Reflection\Metadata\Ecma335\Encoding\ExceptionRegionEncoder.cs" />
<Compile Include="System\Reflection\Metadata\Ecma335\Encoding\InstructionEncoder.cs" />
<Compile Include="System\Reflection\Metadata\Ecma335\Encoding\LabelHandle.cs" />
Expand All @@ -70,7 +70,6 @@
<Compile Include="System\Reflection\Metadata\Ecma335\PortablePdbBuilder.cs" />
<Compile Include="System\Reflection\Metadata\Ecma335\MetadataBuilder.Tables.cs" />
<Compile Include="System\Reflection\Metadata\Ecma335\Encoding\BlobEncoders.cs" />
<Compile Include="System\Reflection\Metadata\Ecma335\Encoding\MethodBodyEncoder.cs" />
<Compile Include="System\Reflection\Metadata\Ecma335\MetadataSizes.cs" />
<Compile Include="System\Reflection\Metadata\Ecma335\MetadataBuilder.Heaps.cs" />
<Compile Include="System\Reflection\Metadata\IL\ILOpCodeExtensions.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ public PermissionSetEncoder AddPermission(string typeName, ImmutableArray<byte>
Builder.WriteSerializedString(typeName);
Builder.WriteCompressedInteger(encodedArguments.Length);
Builder.WriteBytes(encodedArguments);
return new PermissionSetEncoder(Builder);
return this;
}

public PermissionSetEncoder AddPermission(string typeName, BlobBuilder encodedArguments)
Expand All @@ -370,7 +370,7 @@ public PermissionSetEncoder AddPermission(string typeName, BlobBuilder encodedAr
Builder.WriteSerializedString(typeName);
Builder.WriteCompressedInteger(encodedArguments.Count);
encodedArguments.WriteContentTo(Builder);
return new PermissionSetEncoder(Builder);
return this;
}
}

Expand Down

This file was deleted.

Loading

0 comments on commit 9b04bcb

Please sign in to comment.