Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
d8d444d
Add abstract AssemblyBuilder
jkotas Feb 2, 2022
97ed454
Create managed RuntimeAssemblyBuilder
jkotas Feb 6, 2022
791b4cb
Add RuntimeAssemblyBuilder to the build
jkotas Feb 6, 2022
eaa8c73
Boilerplate for RuntimeAssemblyBuilder
jkotas Feb 8, 2022
80c310d
Emit Assembly record
jkotas Feb 9, 2022
c82c7d0
Fixups after rebase
jkotas Feb 9, 2022
85b37d6
Add temporary ReflectionEmitLoadContext
jkotas Feb 9, 2022
cde27c2
Factor out RuntimeModuleBuilder
jkotas Feb 9, 2022
6fe4240
Abstract TypeBuilder and EventBuilder
jkotas Mar 23, 2022
79dd71a
Refactor PropertyBuilder
jkotas Mar 25, 2022
7ec068b
Refactor EnumBuilder
jkotas Mar 25, 2022
b36778c
Refactor FieldBuilder
jkotas Mar 25, 2022
6ee8a67
Refactor ConstructorBuilder and MethodBuilder
jkotas Mar 25, 2022
e127952
Fix app compat issues
buyaa-n Nov 10, 2022
e102000
Revert updates that not needed for initial step
buyaa-n Nov 16, 2022
c32f0e5
Make GenericTypeParameterBuilder abstract
buyaa-n Nov 18, 2022
3b4cba9
Merge conflicts
buyaa-n Nov 18, 2022
0bbcaa7
Fix errors found after merge
buyaa-n Nov 18, 2022
9b96074
Fix app compat issue
buyaa-n Nov 18, 2022
8dcc68d
Merge remote-tracking branch 'upstream/main' into reflection-emit
ViktorHofer Nov 22, 2022
9017148
Move suppressions into the common file
ViktorHofer Nov 22, 2022
a8bf9f2
Update mono implementations
buyaa-n Dec 9, 2022
bab5062
Merge conflicts
buyaa-n Dec 9, 2022
c8a2574
Merge conflicts
buyaa-n Dec 9, 2022
0383fc6
Handle API compat warnings
buyaa-n Dec 9, 2022
b656b01
Fix some failures
buyaa-n Dec 12, 2022
fe0fddf
Mono updates
buyaa-n Dec 13, 2022
3433e5a
Mono updates
buyaa-n Dec 20, 2022
a6928a5
Merge branch 'main' of https://github.com/dotnet/runtime into reflect…
buyaa-n Dec 21, 2022
902f550
Suppress unused variable warning
buyaa-n Dec 21, 2022
a6f202e
Mono failure fixes
buyaa-n Dec 28, 2022
ceb7230
Check ModuleBuilder from generic arguments
buyaa-n Dec 29, 2022
9de8783
Update src/mono/System.Private.CoreLib/src/System/Reflection/Emit/Typ…
buyaa-n Dec 29, 2022
9f07478
Keep runtime old behavior for TypeBuilder static methods
buyaa-n Dec 29, 2022
c4287ae
Merge branch 'reflection-emit' of github.com:buyaa-n/runtime into ref…
buyaa-n Dec 29, 2022
6c1e9ed
Remove/revert some unwanted changes
buyaa-n Jan 3, 2023
dd90d0a
Merge branch 'main' of https://github.com/dotnet/runtime into reflect…
buyaa-n Jan 4, 2023
522d3a7
Merge branch 'main' of https://github.com/dotnet/runtime into reflect…
buyaa-n Jan 5, 2023
a348398
Remove unneeded change
buyaa-n Jan 6, 2023
24f5298
Apply latest feedback
buyaa-n Jan 20, 2023
eeab882
Merge conflict
buyaa-n Jan 20, 2023
34c0216
Use protected absract methods and other related changes
buyaa-n Jan 23, 2023
98ca969
Apply feedback and latest API review updates, refert compat suppressions
buyaa-n Jan 25, 2023
039a89a
Add Assert
buyaa-n Jan 26, 2023
a16ce6e
Fix API compat failures
buyaa-n Jan 27, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Refactor PropertyBuilder
  • Loading branch information
jkotas committed May 6, 2022
commit 79dd71ad82ffe5561820dd52d291326709dcec27
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ namespace System.Reflection.Emit
// A PropertyBuilder is always associated with a TypeBuilder. The TypeBuilder.DefineProperty
// method will return a new PropertyBuilder to a client.
//
public sealed class PropertyBuilder : PropertyInfo
internal sealed class RuntimePropertyBuilder : PropertyBuilder
{
// Constructs a PropertyBuilder.
//
internal PropertyBuilder(
internal RuntimePropertyBuilder(
RuntimeModuleBuilder mod, // the module containing this PropertyBuilder
string name, // property name
PropertyAttributes attr, // property attribute such as DefaultProperty, Bindable, DisplayBind, etc
Expand All @@ -48,7 +48,7 @@ internal PropertyBuilder(
/// <summary>
/// Set the default value of the Property
/// </summary>
public void SetConstant(object? defaultValue)
public override void SetConstant(object? defaultValue)
{
m_containingType.ThrowIfCreated();

Expand Down Expand Up @@ -79,26 +79,26 @@ private void SetMethodSemantics(MethodBuilder mdBuilder, MethodSemanticsAttribut
mdBuilder.MetadataToken);
}

public void SetGetMethod(MethodBuilder mdBuilder)
public override void SetGetMethod(MethodBuilder mdBuilder)
{
SetMethodSemantics(mdBuilder, MethodSemanticsAttributes.Getter);
m_getMethod = mdBuilder;
}

public void SetSetMethod(MethodBuilder mdBuilder)
public override void SetSetMethod(MethodBuilder mdBuilder)
{
SetMethodSemantics(mdBuilder, MethodSemanticsAttributes.Setter);
m_setMethod = mdBuilder;
}

public void AddOtherMethod(MethodBuilder mdBuilder)
public override void AddOtherMethod(MethodBuilder mdBuilder)
{
SetMethodSemantics(mdBuilder, MethodSemanticsAttributes.Other);
}

// Use this function if client decides to form the custom attribute blob themselves

public void SetCustomAttribute(ConstructorInfo con, byte[] binaryAttribute)
public override void SetCustomAttribute(ConstructorInfo con, byte[] binaryAttribute)
{
ArgumentNullException.ThrowIfNull(con);
ArgumentNullException.ThrowIfNull(binaryAttribute);
Expand All @@ -112,7 +112,7 @@ public void SetCustomAttribute(ConstructorInfo con, byte[] binaryAttribute)
}

// Use this function if client wishes to build CustomAttribute using CustomAttributeBuilder
public void SetCustomAttribute(CustomAttributeBuilder customBuilder)
public override void SetCustomAttribute(CustomAttributeBuilder customBuilder)
{
ArgumentNullException.ThrowIfNull(customBuilder);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1654,7 +1654,7 @@ private PropertyBuilder DefinePropertyNoLock(string name, PropertyAttributes att
sigLength);

// create the property builder now.
return new PropertyBuilder(
return new RuntimePropertyBuilder(
m_module,
name,
attributes,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@
<Compile Include="System\Reflection\Emit\LocalBuilder.cs" />
<Compile Include="System\Reflection\Emit\MethodBuilder.cs" />
<Compile Include="System\Reflection\Emit\ParameterBuilder.cs" />
<Compile Include="System\Reflection\Emit\PropertyBuilder.cs" />
<Compile Include="System\Reflection\Emit\ReflectionEmitThrower.cs" />
<Compile Include="System\Reflection\Emit\SignatureHelper.cs" />
<Compile Include="System\Reflection\EnumInfo.cs" />
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,7 @@
<Compile Include="$(MSBuildThisFileDirectory)System\Reflection\Emit\OperandType.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Reflection\Emit\PackingSize.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Reflection\Emit\PEFileKinds.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Reflection\Emit\PropertyBuilder.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Reflection\Emit\StackBehaviour.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Reflection\Emit\TypeBuilder.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Reflection\Emit\TypeNameBuilder.cs" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

namespace System.Reflection.Emit
{
public abstract class PropertyBuilder : PropertyInfo
{
protected PropertyBuilder()
{
}

public virtual void AddOtherMethod(MethodBuilder mdBuilder)
=> AddOtherMethod(mdBuilder);

public virtual void SetConstant(object defaultValue)
=> SetConstant(defaultValue);

public virtual void SetCustomAttribute(ConstructorInfo con, byte[] binaryAttribute)
=> SetCustomAttribute(con, binaryAttribute);

public virtual void SetCustomAttribute(CustomAttributeBuilder customBuilder)
=> SetCustomAttribute(customBuilder);

public virtual void SetGetMethod(MethodBuilder mdBuilder)
=> SetGetMethod(mdBuilder);

public virtual void SetSetMethod(MethodBuilder mdBuilder)
=> SetSetMethod(mdBuilder);
}
}