Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
beyaz committed Jan 28, 2024
1 parent ac8856b commit 4d1ddca
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion ReactWithDotNet/Component.cs
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ protected static IModifier Modify<TComponent>(Action<TComponent> modifyAction)
public sealed class EmptyState;


sealed class AutoGeneratedClass : Component
sealed class CompilerGeneratedClassComponent : Component
{
internal Func<Element> renderFunc;

Expand Down
6 changes: 3 additions & 3 deletions ReactWithDotNet/ComponentRequestHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -264,11 +264,11 @@ async Task<ComponentResponse> handleComponentEvent()
}

object response;
if (instance is AutoGeneratedClass autoGeneratedClass)
if (instance is CompilerGeneratedClassComponent compilerGeneratedClassComponent)
{
autoGeneratedClass.InitializeTarget();
compilerGeneratedClassComponent.InitializeTarget();

response = methodInfo.Invoke(autoGeneratedClass._target, parameters.value);
response = methodInfo.Invoke(compilerGeneratedClassComponent._target, parameters.value);
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion ReactWithDotNet/Element.cs
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ public void Add(Func<Element> elementCreatorFunc)

if (targeType.IsCompilerGenerated())
{
Add(new AutoGeneratedClass
Add(new CompilerGeneratedClassComponent
{
renderFunc = elementCreatorFunc,

Expand Down
22 changes: 11 additions & 11 deletions ReactWithDotNet/ElementSerializer.ToJsonMap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public static async Task<IReadOnlyJsonMap> ToJsonMap(this Element element, Eleme

if (targeType.IsCompilerGenerated())
{
realElement = new AutoGeneratedClass
realElement = new CompilerGeneratedClassComponent
{
renderFunc = funcElement,

Expand Down Expand Up @@ -120,7 +120,7 @@ public static async Task<IReadOnlyJsonMap> ToJsonMap(this Element element, Eleme

if (targeType.IsCompilerGenerated())
{
realElement = new AutoGeneratedClass
realElement = new CompilerGeneratedClassComponent
{
IsRenderAsync = true,

Expand Down Expand Up @@ -381,19 +381,19 @@ public static async Task<IReadOnlyJsonMap> ToJsonMap(this Element element, Eleme
node.Stopwatch.Start();
}

if (node.IsAutoGeneratedClass is null)
if (node.IsCompilerGeneratedClassComponent is null)
{
if (reactStatefulComponent is AutoGeneratedClass autoGeneratedClass)
if (reactStatefulComponent is CompilerGeneratedClassComponent compilerGeneratedClassComponent)
{
context.AutoGeneratedClassStack ??= new();
context.CompilerGeneratedClassComponentStack ??= new();

context.AutoGeneratedClassStack.Push(autoGeneratedClass);
context.CompilerGeneratedClassComponentStack.Push(compilerGeneratedClassComponent);

node.IsAutoGeneratedClass = true;
node.IsCompilerGeneratedClassComponent = true;
}
else
{
node.IsAutoGeneratedClass = false;
node.IsCompilerGeneratedClassComponent = false;
}
}

Expand Down Expand Up @@ -761,9 +761,9 @@ static void copyPropertyValueDeeply(Type dotNetTypeOfReactComponent, object comp
}
}

if (node.IsAutoGeneratedClass is true)
if (node.IsCompilerGeneratedClassComponent is true)
{
context.AutoGeneratedClassStack.Pop();
context.CompilerGeneratedClassComponentStack.Pop();
}

if (node.Stopwatch is not null)
Expand Down Expand Up @@ -1447,7 +1447,7 @@ sealed class Node
public Node Parent { get; set; }
public Stopwatch Stopwatch { get; set; }

public bool? IsAutoGeneratedClass { get; set; }
public bool? IsCompilerGeneratedClassComponent { get; set; }
public bool ElementIsTaskFunc { get; set; }
public ElementAsTaskFunc ElementAsTaskFunc { get; set; }
public bool ElementIsTaskFuncDouble { get; set; }
Expand Down
10 changes: 5 additions & 5 deletions ReactWithDotNet/ElementSerializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ sealed class ElementSerializerContext
public StateTree StateTree { get; init; }
public Tracer Tracer { get; init; }
public bool IsCapturingPreview { get; set; }
public Stack<AutoGeneratedClass> AutoGeneratedClassStack { get; set; }
public Stack<CompilerGeneratedClassComponent> CompilerGeneratedClassComponentStack { get; set; }
}

static partial class ElementSerializer
Expand Down Expand Up @@ -335,9 +335,9 @@ string convertStyleToCssClass(Style style)
}
else
{
if (context.AutoGeneratedClassStack?.Count > 0)
if (context.CompilerGeneratedClassComponentStack?.Count > 0)
{
var handlerComponent = context.AutoGeneratedClassStack.Peek();
var handlerComponent = context.CompilerGeneratedClassComponentStack.Peek();
if (handlerComponent.CompilerGeneratedType == handlerDelegateTarget.GetType())
{
handlerComponentUniqueIdentifier = handlerComponent.ComponentUniqueIdentifier;
Expand Down Expand Up @@ -567,9 +567,9 @@ static async Task<object> GetPropertyValueOfHtmlElement(ElementSerializerContext
}
else
{
if (context.AutoGeneratedClassStack?.Count > 0)
if (context.CompilerGeneratedClassComponentStack?.Count > 0)
{
var handlerComponent = context.AutoGeneratedClassStack.Peek();
var handlerComponent = context.CompilerGeneratedClassComponentStack.Peek();
if (handlerComponent.CompilerGeneratedType == handlerDelegateTarget.GetType())
{
handlerComponentUniqueIdentifier = handlerComponent.ComponentUniqueIdentifier;
Expand Down

0 comments on commit 4d1ddca

Please sign in to comment.