-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Abstract out ParameterBuilder and implement it (#85446)
* Save parameters into assembly and test it * Add MarshalAs pseduo attribute handling and other refactoring * Apply suggestions from code review Co-authored-by: Jan Kotas <[email protected]> --------- Co-authored-by: Jan Kotas <[email protected]>
- Loading branch information
Showing
23 changed files
with
804 additions
and
662 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 0 additions & 73 deletions
73
src/coreclr/nativeaot/System.Private.CoreLib/src/System/Reflection/Emit/ParameterBuilder.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
src/libraries/System.Private.CoreLib/src/System/Reflection/Emit/ParameterBuilder.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
namespace System.Reflection.Emit | ||
{ | ||
public abstract partial class ParameterBuilder | ||
{ | ||
protected ParameterBuilder() { } | ||
public virtual int Attributes => throw new NotImplementedException(); | ||
public bool IsIn => ((ParameterAttributes)Attributes & ParameterAttributes.In) != 0; | ||
public bool IsOptional => ((ParameterAttributes)Attributes & ParameterAttributes.Optional) != 0; | ||
public bool IsOut => ((ParameterAttributes)Attributes & ParameterAttributes.Out) != 0; | ||
public virtual string? Name => throw new NotImplementedException(); | ||
public virtual int Position => throw new NotImplementedException(); | ||
public virtual void SetConstant(object? defaultValue) => throw new NotImplementedException(); | ||
public void SetCustomAttribute(ConstructorInfo con, byte[] binaryAttribute) | ||
{ | ||
ArgumentNullException.ThrowIfNull(con); | ||
ArgumentNullException.ThrowIfNull(binaryAttribute); | ||
|
||
SetCustomAttributeCore(con, binaryAttribute); | ||
} | ||
protected abstract void SetCustomAttributeCore(ConstructorInfo con, ReadOnlySpan<byte> binaryAttribute); | ||
public void SetCustomAttribute(CustomAttributeBuilder customBuilder) | ||
{ | ||
ArgumentNullException.ThrowIfNull(customBuilder); | ||
|
||
SetCustomAttributeCore(customBuilder.Ctor, customBuilder.Data); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.