Skip to content

Commit

Permalink
Hotfix
Browse files Browse the repository at this point in the history
  • Loading branch information
Nyerst committed Mar 6, 2022
1 parent a91c44e commit d40a7b0
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 67 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ public override CodeGenerationResult Generate(in GeneratorOptions options)
builder.AppendLine("static FastNew()");
builder.StartBlock(2);

/*
#region Var constructor
builder.Indent(3);
builder.Append("var constructor = ");
Expand All @@ -134,10 +135,11 @@ public override CodeGenerationResult Generate(in GeneratorOptions options)
builder.UseGenericMember(parameterIndex);
builder.AppendLine($".{ConsructorName};");
#endregion
*/

#region IsValid
builder.Indent(3);
builder.AppendLine("IsValid = constructor != null && !typeof(T).IsAbstract;");
builder.AppendLine($"IsValid = {ConsructorName} != null && !typeof(T).IsAbstract;");
#endregion

#region Parameters
Expand All @@ -159,7 +161,7 @@ public override CodeGenerationResult Generate(in GeneratorOptions options)
builder.AppendLine($">({IsValidName}");

builder.Indent(4);
builder.Append("? (System.Linq.Expressions.Expression)System.Linq.Expressions.Expression.New(constructor!");
builder.Append($"? (System.Linq.Expressions.Expression)System.Linq.Expressions.Expression.New({ConsructorName}!");
/*
builder.GlobalNamespaceDot();
builder.Append(ConstructorOfGenerator.ClassName);
Expand All @@ -177,7 +179,7 @@ public override CodeGenerationResult Generate(in GeneratorOptions options)
builder.Append(": (System.Linq.Expressions.Expression)System.Linq.Expressions.Expression.Call(");
builder.GlobalNamespaceDot();
builder.Append($"{ThrowHelperGenerator.ClassName}.GetSmartThrow<T>(), ");
builder.Append($"System.Linq.Expressions.Expression.Constant({options.GlobalNSDot()}{ClassName}<T>.{ConsructorName}, typeof(ConstructorInfo))");
builder.Append($"System.Linq.Expressions.Expression.Constant({ConsructorName}, typeof(ConstructorInfo))");
builder.AppendLine(')');

builder.Indent(3);
Expand Down
Loading

0 comments on commit d40a7b0

Please sign in to comment.