diff --git a/src/ExpressiveSharp.Generator/Emitter/ReflectionFieldCache.cs b/src/ExpressiveSharp.Generator/Emitter/ReflectionFieldCache.cs
index 178463d..42099d2 100644
--- a/src/ExpressiveSharp.Generator/Emitter/ReflectionFieldCache.cs
+++ b/src/ExpressiveSharp.Generator/Emitter/ReflectionFieldCache.cs
@@ -3,71 +3,59 @@
namespace ExpressiveSharp.Generator.Emitter;
///
-/// Tracks and deduplicates private static readonly reflection field declarations
-/// (, ,
-/// , )
+/// Returns inline reflection expressions for
+/// , ,
+/// , and
/// needed by the emitted expression-tree-building code.
+/// Each Ensure* method returns a C# expression string that evaluates to the
+/// reflection object at runtime, rather than a static field name.
///
internal sealed class ReflectionFieldCache
{
private static readonly SymbolDisplayFormat _fullyQualifiedFormat =
SymbolDisplayFormat.FullyQualifiedFormat;
- private readonly string _prefix;
- private readonly Dictionary _fieldNamesByKey = new();
- private readonly List _declarations = new();
- private int _propertyCounter;
- private int _methodCounter;
- private int _constructorCounter;
- private int _fieldCounter;
+ private readonly Dictionary _expressionsByKey = new();
public ReflectionFieldCache(string prefix = "")
{
- _prefix = prefix;
}
///
- /// Returns the field name for a cached ,
- /// creating the declaration if this property hasn't been seen before.
+ /// Returns an inline reflection expression for a .
///
public string EnsurePropertyInfo(IPropertySymbol property)
{
var typeFqn = property.ContainingType.ToDisplayString(_fullyQualifiedFormat);
var key = $"P:{typeFqn}.{property.Name}";
- if (_fieldNamesByKey.TryGetValue(key, out var fieldName))
- return fieldName;
+ if (_expressionsByKey.TryGetValue(key, out var cached))
+ return cached;
- fieldName = $"_{_prefix}p{_propertyCounter++}";
- var declaration = $"""private static readonly global::System.Reflection.PropertyInfo {fieldName} = typeof({typeFqn}).GetProperty("{property.Name}");""";
- _fieldNamesByKey[key] = fieldName;
- _declarations.Add(declaration);
- return fieldName;
+ var expr = $"typeof({typeFqn}).GetProperty(\"{property.Name}\")";
+ _expressionsByKey[key] = expr;
+ return expr;
}
///
- /// Returns the field name for a cached ,
- /// creating the declaration if this field hasn't been seen before.
+ /// Returns an inline reflection expression for a .
///
public string EnsureFieldInfo(IFieldSymbol field)
{
var typeFqn = field.ContainingType.ToDisplayString(_fullyQualifiedFormat);
var key = $"F:{typeFqn}.{field.Name}";
- if (_fieldNamesByKey.TryGetValue(key, out var fieldName))
- return fieldName;
+ if (_expressionsByKey.TryGetValue(key, out var cached))
+ return cached;
- fieldName = $"_{_prefix}f{_fieldCounter++}";
var flags = field.IsStatic
? "global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static"
: "global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance";
- var declaration = $"""private static readonly global::System.Reflection.FieldInfo {fieldName} = typeof({typeFqn}).GetField("{field.Name}", {flags});""";
- _fieldNamesByKey[key] = fieldName;
- _declarations.Add(declaration);
- return fieldName;
+ var expr = $"typeof({typeFqn}).GetField(\"{field.Name}\", {flags})";
+ _expressionsByKey[key] = expr;
+ return expr;
}
///
- /// Returns the field name for a cached ,
- /// creating the declaration if this method hasn't been seen before.
+ /// Returns an inline reflection expression for a .
///
public string EnsureMethodInfo(IMethodSymbol method)
{
@@ -75,40 +63,34 @@ public string EnsureMethodInfo(IMethodSymbol method)
var paramTypes = string.Join(", ", method.Parameters.Select(p =>
$"typeof({p.Type.ToDisplayString(_fullyQualifiedFormat)})"));
var key = $"M:{typeFqn}.{method.Name}({paramTypes})";
- if (_fieldNamesByKey.TryGetValue(key, out var fieldName))
- return fieldName;
+ if (_expressionsByKey.TryGetValue(key, out var cached))
+ return cached;
- fieldName = $"_{_prefix}m{_methodCounter++}";
var flags = method.IsStatic
? "global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static"
: "global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance";
- string declaration;
+ string expr;
if (method.IsGenericMethod)
{
- // Generic methods: find by name + generic arity + param count, then MakeGenericMethod.
- // We can't use GetMethod with parameter types because the definition's parameters
- // reference its own type parameters (e.g. IEnumerable) which aren't valid C# types.
var originalDef = method.OriginalDefinition;
var genericArity = originalDef.TypeParameters.Length;
var paramCount = originalDef.Parameters.Length;
var typeArgs = string.Join(", ", method.TypeArguments.Select(t =>
$"typeof({t.ToDisplayString(_fullyQualifiedFormat)})"));
- declaration = $"private static readonly global::System.Reflection.MethodInfo {fieldName} = global::System.Linq.Enumerable.First(global::System.Linq.Enumerable.Where(typeof({typeFqn}).GetMethods({flags}), m => m.Name == \"{method.Name}\" && m.IsGenericMethodDefinition && m.GetGenericArguments().Length == {genericArity} && m.GetParameters().Length == {paramCount})).MakeGenericMethod({typeArgs});";
+ expr = $"global::System.Linq.Enumerable.First(global::System.Linq.Enumerable.Where(typeof({typeFqn}).GetMethods({flags}), m => m.Name == \"{method.Name}\" && m.IsGenericMethodDefinition && m.GetGenericArguments().Length == {genericArity} && m.GetParameters().Length == {paramCount})).MakeGenericMethod({typeArgs})";
}
else
{
- declaration = $"private static readonly global::System.Reflection.MethodInfo {fieldName} = typeof({typeFqn}).GetMethod(\"{method.Name}\", {flags}, null, new global::System.Type[] {{ {paramTypes} }}, null);";
+ expr = $"typeof({typeFqn}).GetMethod(\"{method.Name}\", {flags}, null, new global::System.Type[] {{ {paramTypes} }}, null)";
}
- _fieldNamesByKey[key] = fieldName;
- _declarations.Add(declaration);
- return fieldName;
+ _expressionsByKey[key] = expr;
+ return expr;
}
///
- /// Returns the field name for a cached ,
- /// creating the declaration if this constructor hasn't been seen before.
+ /// Returns an inline reflection expression for a .
///
public string EnsureConstructorInfo(IMethodSymbol constructor)
{
@@ -116,21 +98,19 @@ public string EnsureConstructorInfo(IMethodSymbol constructor)
var paramTypes = string.Join(", ", constructor.Parameters.Select(p =>
$"typeof({p.Type.ToDisplayString(_fullyQualifiedFormat)})"));
var key = $"C:{typeFqn}({paramTypes})";
- if (_fieldNamesByKey.TryGetValue(key, out var fieldName))
- return fieldName;
+ if (_expressionsByKey.TryGetValue(key, out var cached))
+ return cached;
- fieldName = $"_{_prefix}c{_constructorCounter++}";
- var declaration = $"private static readonly global::System.Reflection.ConstructorInfo {fieldName} = typeof({typeFqn}).GetConstructor(new global::System.Type[] {{ {paramTypes} }});";
- _fieldNamesByKey[key] = fieldName;
- _declarations.Add(declaration);
- return fieldName;
+ var expr = $"typeof({typeFqn}).GetConstructor(new global::System.Type[] {{ {paramTypes} }})";
+ _expressionsByKey[key] = expr;
+ return expr;
}
///
- /// Returns all generated private static readonly field declarations.
+ /// Returns all static field declarations. Always empty since reflection is now inlined.
///
public IReadOnlyList GetDeclarations()
{
- return _declarations;
+ return Array.Empty();
}
}
diff --git a/src/ExpressiveSharp.Generator/ExpressiveGenerator.cs b/src/ExpressiveSharp.Generator/ExpressiveGenerator.cs
index b5d1ecd..c1df0a2 100644
--- a/src/ExpressiveSharp.Generator/ExpressiveGenerator.cs
+++ b/src/ExpressiveSharp.Generator/ExpressiveGenerator.cs
@@ -117,24 +117,29 @@ private static void Execute(
factoryCandidate.Identifier.Text));
}
- var generatedClassName = ExpressionClassNameGenerator.GenerateName(expressive.ClassNamespace, expressive.NestedInClassNames, expressive.MemberName, expressive.ParameterTypeNames);
- var generatedFileName = expressive.ClassTypeParameterList is not null ? $"{generatedClassName}-{expressive.ClassTypeParameterList.Parameters.Count}.g.cs" : $"{generatedClassName}.g.cs";
+ var generatedClassName = ExpressionClassNameGenerator.GenerateClassName(expressive.ClassNamespace, expressive.NestedInClassNames);
+ var methodSuffix = ExpressionClassNameGenerator.GenerateMethodSuffix(expressive.MemberName, expressive.ParameterTypeNames);
+ var generatedFileName = expressive.ClassTypeParameterList is not null
+ ? $"{generatedClassName}-{expressive.ClassTypeParameterList.Parameters.Count}.{methodSuffix}.g.cs"
+ : $"{generatedClassName}.{methodSuffix}.g.cs";
if (expressive.ExpressionTreeEmission is null)
{
throw new InvalidOperationException("ExpressionTreeEmission must be set");
}
- EmitExpressionTreeSource(expressive, generatedClassName, generatedFileName, member, compilation, context);
+ EmitExpressionTreeSource(expressive, generatedClassName, methodSuffix, generatedFileName, member, compilation, context);
}
///
/// Emits the generated source file using raw text when is available.
- /// This path generates imperative Expression.* factory calls instead of a lambda return.
+ /// Each file declares the same static partial class — one per declaring type — and adds
+ /// a uniquely-named {methodSuffix}_Expression() method for this member.
///
private static void EmitExpressionTreeSource(
ExpressiveDescriptor expressive,
string generatedClassName,
+ string methodSuffix,
string generatedFileName,
MemberDeclarationSyntax member,
Compilation? compilation,
@@ -186,21 +191,9 @@ private static void EmitExpressionTreeSource(
? string.Join(" ", expressive.ConstraintClauses.Value.Select(c => c.NormalizeWhitespace().ToFullString()))
: "";
- sb.AppendLine($" [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]");
- sb.AppendLine($" static class {generatedClassName}{typeParamList} {constraintClauses}");
+ sb.AppendLine($" static partial class {generatedClassName}{typeParamList} {constraintClauses}");
sb.AppendLine(" {");
- // Static fields for cached reflection info
- foreach (var field in emission.StaticFields)
- {
- sb.AppendLine($" {field}");
- }
-
- if (emission.StaticFields.Count > 0)
- {
- sb.AppendLine();
- }
-
// Source comment showing the original C# member
var sourceText = member.NormalizeWhitespace().ToFullString();
foreach (var line in sourceText.Split('\n'))
@@ -209,19 +202,19 @@ private static void EmitExpressionTreeSource(
sb.AppendLine($" // {trimmed}");
}
- // Expression() method
- sb.AppendLine($" static {returnType} Expression{methodTypeParamList}() {methodConstraintClauses}");
+ // {methodSuffix}_Expression() method
+ sb.AppendLine($" static {returnType} {methodSuffix}_Expression{methodTypeParamList}() {methodConstraintClauses}");
sb.AppendLine(" {");
sb.Append(emission.Body);
sb.AppendLine(" }");
- // Transformers property (when declared via attribute)
+ // Transformers (when declared via attribute)
if (expressive.DeclaredTransformerTypeNames.Count > 0)
{
sb.AppendLine();
var transformerInstances = string.Join(", ",
expressive.DeclaredTransformerTypeNames.Select(t => $"new {t}()"));
- sb.AppendLine($" static global::ExpressiveSharp.IExpressionTreeTransformer[] Transformers() => [{transformerInstances}];");
+ sb.AppendLine($" static global::ExpressiveSharp.IExpressionTreeTransformer[] {methodSuffix}_Transformers() => [{transformerInstances}];");
}
sb.AppendLine(" }");
@@ -239,16 +232,22 @@ private static void EmitExpressionTreeSource(
{
var containingType = memberSymbol.ContainingType;
- // Skip C# 14 extension type members — they require special handling (fall back to reflection)
+ // Determine whether this entry is metadata-only (excluded from runtime registry
+ // but still used for [EditorBrowsable] attribute-only partial file emission).
+ var isMetadataOnly = false;
+ string? classTypeParameters = null;
+
+ // C# 14 extension type members — metadata-only (fall back to reflection at runtime)
if (containingType is { IsExtension: true })
{
- return null;
+ isMetadataOnly = true;
}
- // Skip generic classes: the registry only supports closed constructed types.
+ // Generic classes — metadata-only (registry can't represent open generic types)
if (containingType.TypeParameters.Length > 0)
{
- return null;
+ isMetadataOnly = true;
+ classTypeParameters = "<" + string.Join(", ", containingType.TypeParameters.Select(tp => tp.Name)) + ">";
}
// Determine member kind and lookup name
@@ -258,10 +257,10 @@ private static void EmitExpressionTreeSource(
if (memberSymbol is IMethodSymbol methodSymbol)
{
- // Skip generic methods for the same reason as generic classes
+ // Generic methods — metadata-only (same reason as generic classes)
if (methodSymbol.TypeParameters.Length > 0)
{
- return null;
+ isMetadataOnly = true;
}
if (methodSymbol.MethodKind is MethodKind.Constructor or MethodKind.StaticConstructor)
@@ -285,20 +284,22 @@ private static void EmitExpressionTreeSource(
memberLookupName = memberSymbol.Name;
}
- // Build the generated class name using the same logic as Execute
+ // Build the generated class name and method name using the same logic as Execute
var classNamespace = containingType.ContainingNamespace.IsGlobalNamespace
? null
: containingType.ContainingNamespace.ToDisplayString();
var nestedTypePath = GetRegistryNestedTypePath(containingType);
- var generatedClassName = ExpressionClassNameGenerator.GenerateName(
+ var generatedClassFullName = ExpressionClassNameGenerator.GenerateClassFullName(
classNamespace,
- nestedTypePath,
+ nestedTypePath);
+
+ var methodSuffix = ExpressionClassNameGenerator.GenerateMethodSuffix(
memberLookupName,
parameterTypeNames.IsEmpty ? null : parameterTypeNames);
- var generatedClassFullName = "ExpressiveSharp.Generated." + generatedClassName;
+ var expressionMethodName = methodSuffix + "_Expression";
var declaringTypeFullName = containingType.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat);
@@ -307,7 +308,10 @@ private static void EmitExpressionTreeSource(
MemberKind: memberKind,
MemberLookupName: memberLookupName,
GeneratedClassFullName: generatedClassFullName,
- ParameterTypeNames: parameterTypeNames);
+ ExpressionMethodName: expressionMethodName,
+ ParameterTypeNames: parameterTypeNames,
+ IsMetadataOnly: isMetadataOnly,
+ ClassTypeParameters: classTypeParameters);
}
private static IEnumerable GetRegistryNestedTypePath(INamedTypeSymbol typeSymbol)
diff --git a/src/ExpressiveSharp.Generator/Registry/ExpressionRegistryEmitter.cs b/src/ExpressiveSharp.Generator/Registry/ExpressionRegistryEmitter.cs
index 6065a4a..dda36fa 100644
--- a/src/ExpressiveSharp.Generator/Registry/ExpressionRegistryEmitter.cs
+++ b/src/ExpressiveSharp.Generator/Registry/ExpressionRegistryEmitter.cs
@@ -25,12 +25,23 @@ static internal class ExpressionRegistryEmitter
///
public static void Emit(ImmutableArray entries, SourceProductionContext context)
{
- var validEntries = entries
+ var allEntries = entries
.Where(e => e is not null)
.Select(e => e!)
.ToList();
- if (validEntries.Count == 0)
+ if (allEntries.Count == 0)
+ {
+ return;
+ }
+
+ // Emit [EditorBrowsable] attribute-only partial files for each unique generated class.
+ EmitEditorBrowsablePartialFiles(allEntries, context);
+
+ // Filter to registry-eligible entries (exclude metadata-only entries for generic/extension classes).
+ var registryEntries = allEntries.Where(e => !e.IsMetadataOnly).ToList();
+
+ if (registryEntries.Count == 0)
{
return;
}
@@ -57,7 +68,7 @@ public static void Emit(ImmutableArray entries, Source
writer.WriteLine("{");
writer.Indent++;
- EmitBuildMethod(writer, validEntries);
+ EmitBuildMethod(writer, registryEntries);
writer.WriteLine();
EmitMapField(writer);
writer.WriteLine();
@@ -126,7 +137,7 @@ private static void WriteRegistryEntryStatement(IndentedTextWriter writer, Expre
if (memberCallExpr is not null)
{
- writer.WriteLine($"Register(map, {memberCallExpr}, \"{entry.GeneratedClassFullName}\");");
+ writer.WriteLine($"Register(map, {memberCallExpr}, \"{entry.GeneratedClassFullName}\", \"{entry.ExpressionMethodName}\");");
}
}
@@ -174,17 +185,22 @@ private static void EmitTryGetMethod(IndentedTextWriter writer)
///
private static void EmitRegisterHelper(IndentedTextWriter writer)
{
- writer.WriteLine("private static void Register(Dictionary map, MethodBase m, string exprClass)");
+ writer.WriteLine("private static void Register(Dictionary map, MethodBase m, string exprClass, string exprMethodName)");
writer.WriteLine("{");
writer.Indent++;
writer.WriteLine("if (m is null) return;");
writer.WriteLine("var exprType = m.DeclaringType?.Assembly.GetType(exprClass);");
- writer.WriteLine(@"var exprMethod = exprType?.GetMethod(""Expression"", BindingFlags.Static | BindingFlags.NonPublic);");
+ writer.WriteLine(@"var exprMethod = exprType?.GetMethod(exprMethodName, BindingFlags.Static | BindingFlags.NonPublic);");
writer.WriteLine("if (exprMethod is null) return;");
writer.WriteLine("var expr = (LambdaExpression)exprMethod.Invoke(null, null)!;");
writer.WriteLine();
writer.WriteLine("// Apply declared transformers from the generated class (if any)");
- writer.WriteLine(@"var transformersMethod = exprType.GetMethod(""Transformers"", BindingFlags.Static | BindingFlags.NonPublic);");
+ writer.WriteLine(@"const string expressionSuffix = ""_Expression"";");
+ writer.WriteLine(@"if (exprMethodName.EndsWith(expressionSuffix, StringComparison.Ordinal))");
+ writer.WriteLine("{");
+ writer.Indent++;
+ writer.WriteLine(@"var transformersSuffix = exprMethodName.Substring(0, exprMethodName.Length - expressionSuffix.Length) + ""_Transformers"";");
+ writer.WriteLine(@"var transformersMethod = exprType.GetMethod(transformersSuffix, BindingFlags.Static | BindingFlags.NonPublic);");
writer.WriteLine(@"if (transformersMethod?.Invoke(null, null) is global::ExpressiveSharp.IExpressionTreeTransformer[] transformers)");
writer.WriteLine("{");
writer.Indent++;
@@ -193,6 +209,8 @@ private static void EmitRegisterHelper(IndentedTextWriter writer)
writer.WriteLine("if (transformed is LambdaExpression lambdaResult) expr = lambdaResult;");
writer.Indent--;
writer.WriteLine("}");
+ writer.Indent--;
+ writer.WriteLine("}");
writer.WriteLine();
writer.WriteLine("map[m.MethodHandle.Value] = expr;");
writer.Indent--;
@@ -213,4 +231,51 @@ private static string BuildTypeArrayExpr(ImmutableArray parameterTypeNam
var typeofExprs = string.Join(", ", parameterTypeNames.Select(name => $"typeof({name})"));
return $"new global::System.Type[] {{ {typeofExprs} }}";
}
+
+ ///
+ /// Emits a single [EditorBrowsable(Never)] attribute-only partial class file
+ /// for each unique generated class. This ensures the attribute appears exactly once
+ /// per class, avoiding CS0579 (duplicate attribute) across per-member partial files.
+ ///
+ private static void EmitEditorBrowsablePartialFiles(List allEntries, SourceProductionContext context)
+ {
+ // Group by class full name to emit one file per unique class.
+ // Use the first entry per class to get type parameter info.
+ var seenClasses = new Dictionary();
+ foreach (var entry in allEntries)
+ {
+ if (!seenClasses.ContainsKey(entry.GeneratedClassFullName))
+ {
+ seenClasses[entry.GeneratedClassFullName] = entry;
+ }
+ }
+
+ foreach (var kvp in seenClasses)
+ {
+ var classFullName = kvp.Key;
+ var entry = kvp.Value;
+
+ // Extract the simple class name from the full name (after the last '.')
+ var className = classFullName;
+ var lastDot = classFullName.LastIndexOf('.');
+ if (lastDot >= 0)
+ {
+ className = classFullName.Substring(lastDot + 1);
+ }
+
+ var typeParams = entry.ClassTypeParameters ?? "";
+
+ var sb = new StringBuilder();
+ sb.AppendLine("// ");
+ sb.AppendLine();
+ sb.AppendLine("namespace ExpressiveSharp.Generated");
+ sb.AppendLine("{");
+ sb.AppendLine(" [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]");
+ sb.AppendLine($" static partial class {className}{typeParams} {{ }}");
+ sb.AppendLine("}");
+
+ context.AddSource($"{className}.Attributes.g.cs",
+ SourceText.From(sb.ToString(), Encoding.UTF8));
+ }
+ }
}
diff --git a/src/ExpressiveSharp.Generator/Registry/ExpressionRegistryEntry.cs b/src/ExpressiveSharp.Generator/Registry/ExpressionRegistryEntry.cs
index b935431..9c6617b 100644
--- a/src/ExpressiveSharp.Generator/Registry/ExpressionRegistryEntry.cs
+++ b/src/ExpressiveSharp.Generator/Registry/ExpressionRegistryEntry.cs
@@ -12,7 +12,10 @@ sealed internal record ExpressionRegistryEntry(
ExpressionRegistryMemberType MemberKind,
string MemberLookupName,
string GeneratedClassFullName,
- EquatableImmutableArray ParameterTypeNames
+ string ExpressionMethodName,
+ EquatableImmutableArray ParameterTypeNames,
+ bool IsMetadataOnly = false,
+ string? ClassTypeParameters = null
);
///
diff --git a/src/ExpressiveSharp/Services/ExpressionClassNameGenerator.cs b/src/ExpressiveSharp/Services/ExpressionClassNameGenerator.cs
index f0f463d..9beffdb 100644
--- a/src/ExpressiveSharp/Services/ExpressionClassNameGenerator.cs
+++ b/src/ExpressiveSharp/Services/ExpressionClassNameGenerator.cs
@@ -34,6 +34,112 @@ public static string GenerateFullName(string? namespaceName, IEnumerable
return GenerateNameImpl(stringBuilder, namespaceName, nestedInClassNames, memberName, parameterTypeNames);
}
+ ///
+ /// Generates the class-level name (without member or parameter suffixes) for the
+ /// consolidated partial class that holds all expression methods for a given type.
+ ///
+ public static string GenerateClassName(string? namespaceName, IEnumerable? nestedInClassNames)
+ {
+ var sb = new StringBuilder();
+ return GenerateClassNameImpl(sb, namespaceName, nestedInClassNames);
+ }
+
+ ///
+ /// Generates the fully-qualified class name (with prefix)
+ /// for the consolidated partial class.
+ ///
+ public static string GenerateClassFullName(string? namespaceName, IEnumerable? nestedInClassNames)
+ {
+ var sb = new StringBuilder(Namespace);
+ sb.Append('.');
+ return GenerateClassNameImpl(sb, namespaceName, nestedInClassNames);
+ }
+
+ ///
+ /// Generates the method suffix that encodes a member name and its parameter types.
+ /// The result is used as a method name prefix (e.g. "Add_P0_int") within the
+ /// consolidated partial class.
+ ///
+ public static string GenerateMethodSuffix(string memberName, IEnumerable? parameterTypeNames)
+ {
+ var sb = new StringBuilder();
+
+ if (memberName.IndexOf('.') >= 0)
+ {
+ sb.Append(memberName.Replace(".", "__"));
+ }
+ else
+ {
+ sb.Append(memberName);
+ }
+
+ if (parameterTypeNames is not null)
+ {
+ var parameterIndex = 0;
+ foreach (var parameterTypeName in parameterTypeNames)
+ {
+ sb.Append("_P");
+ sb.Append(parameterIndex);
+ sb.Append('_');
+ AppendSanitizedTypeName(sb, parameterTypeName);
+ parameterIndex++;
+ }
+ }
+
+ return sb.ToString();
+ }
+
+ static string GenerateClassNameImpl(StringBuilder stringBuilder, string? namespaceName, IEnumerable? nestedInClassNames)
+ {
+ if (namespaceName is not null)
+ {
+ foreach (var c in namespaceName)
+ {
+ stringBuilder.Append(c == '.' ? '_' : c);
+ }
+ }
+
+ stringBuilder.Append('_');
+ var arity = 0;
+
+ if (nestedInClassNames is not null)
+ {
+ foreach (var className in nestedInClassNames)
+ {
+ var arityCharacterIndex = className.IndexOf('`');
+ if (arityCharacterIndex is -1)
+ {
+ stringBuilder.Append(className);
+ }
+ else
+ {
+#if NETSTANDARD2_0
+ arity += int.Parse(className.Substring(arityCharacterIndex + 1));
+#else
+ arity += int.Parse(className.AsSpan().Slice(arityCharacterIndex + 1));
+#endif
+ stringBuilder.Append(className, 0, arityCharacterIndex);
+ }
+
+ stringBuilder.Append('_');
+ }
+ }
+
+ // Remove trailing '_' from class names (the member name used to follow)
+ if (stringBuilder.Length > 0 && stringBuilder[stringBuilder.Length - 1] == '_')
+ {
+ stringBuilder.Length--;
+ }
+
+ if (arity > 0)
+ {
+ stringBuilder.Append('`');
+ stringBuilder.Append(arity);
+ }
+
+ return stringBuilder.ToString();
+ }
+
static string GenerateNameImpl(StringBuilder stringBuilder, string? namespaceName, IEnumerable? nestedInClassNames, string memberName, IEnumerable? parameterTypeNames)
{
// Append namespace, replacing '.' separators with '_' in a single pass (no intermediate string).
diff --git a/src/ExpressiveSharp/Services/ExpressiveResolver.cs b/src/ExpressiveSharp/Services/ExpressiveResolver.cs
index f5bfdc6..ebf5dfe 100644
--- a/src/ExpressiveSharp/Services/ExpressiveResolver.cs
+++ b/src/ExpressiveSharp/Services/ExpressiveResolver.cs
@@ -216,12 +216,16 @@ private static LambdaExpression ResolveExpressionCore(MemberInfo expressiveMembe
}
}
- // GetNestedTypePath() returns a Type[] — project to string[] with a direct loop, no LINQ Select.
- var generatedContainingTypeName = ExpressionClassNameGenerator.GenerateFullName(
+ // Build the generated class name (without member) and method suffix separately.
+ var nestedTypeNames = NestedTypePathToNames(declaringType.GetNestedTypePath());
+ var generatedContainingTypeName = ExpressionClassNameGenerator.GenerateClassFullName(
declaringType.Namespace,
- NestedTypePathToNames(declaringType.GetNestedTypePath()),
+ nestedTypeNames);
+
+ var methodSuffix = ExpressionClassNameGenerator.GenerateMethodSuffix(
memberLookupName,
parameterTypeNames);
+ var expressionMethodName = methodSuffix + "_Expression";
var expressionFactoryType = declaringType.Assembly.GetType(generatedContainingTypeName);
@@ -235,7 +239,7 @@ private static LambdaExpression ResolveExpressionCore(MemberInfo expressiveMembe
expressionFactoryType = expressionFactoryType.MakeGenericType(originalDeclaringType.GenericTypeArguments);
}
- var expressionFactoryMethod = expressionFactoryType.GetMethod("Expression", BindingFlags.Static | BindingFlags.NonPublic);
+ var expressionFactoryMethod = expressionFactoryType.GetMethod(expressionMethodName, BindingFlags.Static | BindingFlags.NonPublic);
if (expressionFactoryMethod is null)
{
@@ -252,7 +256,8 @@ private static LambdaExpression ResolveExpressionCore(MemberInfo expressiveMembe
return null;
// Apply declared transformers from the generated class (if any)
- var transformersMethod = expressionFactoryType.GetMethod("Transformers", BindingFlags.Static | BindingFlags.NonPublic);
+ var transformerMethodName = methodSuffix + "_Transformers";
+ var transformersMethod = expressionFactoryType.GetMethod(transformerMethodName, BindingFlags.Static | BindingFlags.NonPublic);
if (transformersMethod?.Invoke(null, null) is IExpressionTreeTransformer[] transformers)
{
Expression result = expression;
diff --git a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/BlockBodyTests.BlockBodiedMethod_SimpleReturn.verified.txt b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/BlockBodyTests.BlockBodiedMethod_SimpleReturn.verified.txt
index c1e75bc..5eec2a2 100644
--- a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/BlockBodyTests.BlockBodiedMethod_SimpleReturn.verified.txt
+++ b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/BlockBodyTests.BlockBodiedMethod_SimpleReturn.verified.txt
@@ -5,15 +5,14 @@ using Foo;
namespace ExpressiveSharp.Generated
{
- [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
- static class Foo_C_Foo
+ static partial class Foo_C
{
// [Expressive(AllowBlockBody = true)]
// public int Foo()
// {
// return 42;
// }
- static global::System.Linq.Expressions.Expression> Expression()
+ static global::System.Linq.Expressions.Expression> Foo_Expression()
{
var p__this = global::System.Linq.Expressions.Expression.Parameter(typeof(global::Foo.C), "@this");
var expr_0 = global::System.Linq.Expressions.Expression.Constant(42, typeof(int)); // 42
diff --git a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/BlockBodyTests.BlockBodiedMethod_WithIfElse.verified.txt b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/BlockBodyTests.BlockBodiedMethod_WithIfElse.verified.txt
index bbe15dd..47c619d 100644
--- a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/BlockBodyTests.BlockBodiedMethod_WithIfElse.verified.txt
+++ b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/BlockBodyTests.BlockBodiedMethod_WithIfElse.verified.txt
@@ -5,11 +5,8 @@ using Foo;
namespace ExpressiveSharp.Generated
{
- [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
- static class Foo_C_Foo
+ static partial class Foo_C
{
- private static readonly global::System.Reflection.PropertyInfo _p0 = typeof(global::Foo.C).GetProperty("Bar");
-
// [Expressive(AllowBlockBody = true)]
// public int Foo()
// {
@@ -22,10 +19,10 @@ namespace ExpressiveSharp.Generated
// return 0;
// }
// }
- static global::System.Linq.Expressions.Expression> Expression()
+ static global::System.Linq.Expressions.Expression> Foo_Expression()
{
var p__this = global::System.Linq.Expressions.Expression.Parameter(typeof(global::Foo.C), "@this");
- var expr_2 = global::System.Linq.Expressions.Expression.Property(p__this, _p0); // Bar
+ var expr_2 = global::System.Linq.Expressions.Expression.Property(p__this, typeof(global::Foo.C).GetProperty("Bar")); // Bar
var expr_3 = global::System.Linq.Expressions.Expression.Constant(10, typeof(int)); // 10
var expr_1 = global::System.Linq.Expressions.Expression.MakeBinary(global::System.Linq.Expressions.ExpressionType.GreaterThan, expr_2, expr_3);
var expr_4 = global::System.Linq.Expressions.Expression.Constant(1, typeof(int)); // 1
diff --git a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/BlockBodyTests.BlockBodiedMethod_WithLocalVariable.verified.txt b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/BlockBodyTests.BlockBodiedMethod_WithLocalVariable.verified.txt
index 857e45c..26bd7b2 100644
--- a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/BlockBodyTests.BlockBodiedMethod_WithLocalVariable.verified.txt
+++ b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/BlockBodyTests.BlockBodiedMethod_WithLocalVariable.verified.txt
@@ -5,22 +5,19 @@ using Foo;
namespace ExpressiveSharp.Generated
{
- [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
- static class Foo_C_Foo
+ static partial class Foo_C
{
- private static readonly global::System.Reflection.PropertyInfo _p0 = typeof(global::Foo.C).GetProperty("Bar");
-
// [Expressive(AllowBlockBody = true)]
// public int Foo()
// {
// var temp = Bar * 2;
// return temp + 5;
// }
- static global::System.Linq.Expressions.Expression> Expression()
+ static global::System.Linq.Expressions.Expression> Foo_Expression()
{
var p__this = global::System.Linq.Expressions.Expression.Parameter(typeof(global::Foo.C), "@this");
var expr_0 = global::System.Linq.Expressions.Expression.Variable(typeof(int), "temp"); // { var temp = Bar * 2; return temp...
- var expr_2 = global::System.Linq.Expressions.Expression.Property(p__this, _p0); // Bar
+ var expr_2 = global::System.Linq.Expressions.Expression.Property(p__this, typeof(global::Foo.C).GetProperty("Bar")); // Bar
var expr_3 = global::System.Linq.Expressions.Expression.Constant(2, typeof(int)); // 2
var expr_1 = global::System.Linq.Expressions.Expression.MakeBinary(global::System.Linq.Expressions.ExpressionType.Multiply, expr_2, expr_3);
var expr_4 = global::System.Linq.Expressions.Expression.Assign(expr_0, expr_1);
diff --git a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/BlockBodyTests.BlockBodiedMethod_WithNestedIfElse.verified.txt b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/BlockBodyTests.BlockBodiedMethod_WithNestedIfElse.verified.txt
index a8c58c3..fb92d48 100644
--- a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/BlockBodyTests.BlockBodiedMethod_WithNestedIfElse.verified.txt
+++ b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/BlockBodyTests.BlockBodiedMethod_WithNestedIfElse.verified.txt
@@ -5,11 +5,8 @@ using Foo;
namespace ExpressiveSharp.Generated
{
- [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
- static class Foo_C_Foo
+ static partial class Foo_C
{
- private static readonly global::System.Reflection.PropertyInfo _p0 = typeof(global::Foo.C).GetProperty("Bar");
-
// [Expressive(AllowBlockBody = true)]
// public string Foo()
// {
@@ -26,14 +23,14 @@ namespace ExpressiveSharp.Generated
// return "Low";
// }
// }
- static global::System.Linq.Expressions.Expression> Expression()
+ static global::System.Linq.Expressions.Expression> Foo_Expression()
{
var p__this = global::System.Linq.Expressions.Expression.Parameter(typeof(global::Foo.C), "@this");
- var expr_2 = global::System.Linq.Expressions.Expression.Property(p__this, _p0); // Bar
+ var expr_2 = global::System.Linq.Expressions.Expression.Property(p__this, typeof(global::Foo.C).GetProperty("Bar")); // Bar
var expr_3 = global::System.Linq.Expressions.Expression.Constant(10, typeof(int)); // 10
var expr_1 = global::System.Linq.Expressions.Expression.MakeBinary(global::System.Linq.Expressions.ExpressionType.GreaterThan, expr_2, expr_3);
var expr_4 = global::System.Linq.Expressions.Expression.Constant("High", typeof(string)); // "High"
- var expr_7 = global::System.Linq.Expressions.Expression.Property(p__this, _p0); // Bar
+ var expr_7 = global::System.Linq.Expressions.Expression.Property(p__this, typeof(global::Foo.C).GetProperty("Bar")); // Bar
var expr_8 = global::System.Linq.Expressions.Expression.Constant(5, typeof(int)); // 5
var expr_6 = global::System.Linq.Expressions.Expression.MakeBinary(global::System.Linq.Expressions.ExpressionType.GreaterThan, expr_7, expr_8);
var expr_9 = global::System.Linq.Expressions.Expression.Constant("Medium", typeof(string)); // "Medium"
diff --git a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/BlockBodyTests.BlockBodiedMethod_WithPropertyAccess.verified.txt b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/BlockBodyTests.BlockBodiedMethod_WithPropertyAccess.verified.txt
index 7126f3d..cb16535 100644
--- a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/BlockBodyTests.BlockBodiedMethod_WithPropertyAccess.verified.txt
+++ b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/BlockBodyTests.BlockBodiedMethod_WithPropertyAccess.verified.txt
@@ -5,20 +5,17 @@ using Foo;
namespace ExpressiveSharp.Generated
{
- [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
- static class Foo_C_Foo
+ static partial class Foo_C
{
- private static readonly global::System.Reflection.PropertyInfo _p0 = typeof(global::Foo.C).GetProperty("Bar");
-
// [Expressive(AllowBlockBody = true)]
// public int Foo()
// {
// return Bar + 10;
// }
- static global::System.Linq.Expressions.Expression> Expression()
+ static global::System.Linq.Expressions.Expression> Foo_Expression()
{
var p__this = global::System.Linq.Expressions.Expression.Parameter(typeof(global::Foo.C), "@this");
- var expr_1 = global::System.Linq.Expressions.Expression.Property(p__this, _p0); // Bar
+ var expr_1 = global::System.Linq.Expressions.Expression.Property(p__this, typeof(global::Foo.C).GetProperty("Bar")); // Bar
var expr_2 = global::System.Linq.Expressions.Expression.Constant(10, typeof(int)); // 10
var expr_0 = global::System.Linq.Expressions.Expression.MakeBinary(global::System.Linq.Expressions.ExpressionType.Add, expr_1, expr_2);
return global::System.Linq.Expressions.Expression.Lambda>(expr_0, p__this);
diff --git a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/BlockBodyTests.BlockBodiedMethod_WithTransitiveLocalVariables.verified.txt b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/BlockBodyTests.BlockBodiedMethod_WithTransitiveLocalVariables.verified.txt
index 3fdc53e..769da89 100644
--- a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/BlockBodyTests.BlockBodiedMethod_WithTransitiveLocalVariables.verified.txt
+++ b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/BlockBodyTests.BlockBodiedMethod_WithTransitiveLocalVariables.verified.txt
@@ -5,11 +5,8 @@ using Foo;
namespace ExpressiveSharp.Generated
{
- [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
- static class Foo_C_Foo
+ static partial class Foo_C
{
- private static readonly global::System.Reflection.PropertyInfo _p0 = typeof(global::Foo.C).GetProperty("Bar");
-
// [Expressive(AllowBlockBody = true)]
// public int Foo()
// {
@@ -17,11 +14,11 @@ namespace ExpressiveSharp.Generated
// var b = a + 5;
// return b + 10;
// }
- static global::System.Linq.Expressions.Expression> Expression()
+ static global::System.Linq.Expressions.Expression> Foo_Expression()
{
var p__this = global::System.Linq.Expressions.Expression.Parameter(typeof(global::Foo.C), "@this");
var expr_0 = global::System.Linq.Expressions.Expression.Variable(typeof(int), "a"); // { var a = Bar * 2; var b = a + 5;...
- var expr_2 = global::System.Linq.Expressions.Expression.Property(p__this, _p0); // Bar
+ var expr_2 = global::System.Linq.Expressions.Expression.Property(p__this, typeof(global::Foo.C).GetProperty("Bar")); // Bar
var expr_3 = global::System.Linq.Expressions.Expression.Constant(2, typeof(int)); // 2
var expr_1 = global::System.Linq.Expressions.Expression.MakeBinary(global::System.Linq.Expressions.ExpressionType.Multiply, expr_2, expr_3);
var expr_4 = global::System.Linq.Expressions.Expression.Assign(expr_0, expr_1);
diff --git a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/CheckedArithmeticTests.CheckedAddition.verified.txt b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/CheckedArithmeticTests.CheckedAddition.verified.txt
index dc3879e..f209761 100644
--- a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/CheckedArithmeticTests.CheckedAddition.verified.txt
+++ b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/CheckedArithmeticTests.CheckedAddition.verified.txt
@@ -5,19 +5,15 @@ using Foo;
namespace ExpressiveSharp.Generated
{
- [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
- static class Foo_C_Sum
+ static partial class Foo_C
{
- private static readonly global::System.Reflection.PropertyInfo _p0 = typeof(global::Foo.C).GetProperty("A");
- private static readonly global::System.Reflection.PropertyInfo _p1 = typeof(global::Foo.C).GetProperty("B");
-
// [Expressive]
// public int Sum => checked(A + B);
- static global::System.Linq.Expressions.Expression> Expression()
+ static global::System.Linq.Expressions.Expression> Sum_Expression()
{
var p__this = global::System.Linq.Expressions.Expression.Parameter(typeof(global::Foo.C), "@this");
- var expr_1 = global::System.Linq.Expressions.Expression.Property(p__this, _p0); // A
- var expr_2 = global::System.Linq.Expressions.Expression.Property(p__this, _p1); // B
+ var expr_1 = global::System.Linq.Expressions.Expression.Property(p__this, typeof(global::Foo.C).GetProperty("A")); // A
+ var expr_2 = global::System.Linq.Expressions.Expression.Property(p__this, typeof(global::Foo.C).GetProperty("B")); // B
var expr_0 = global::System.Linq.Expressions.Expression.MakeBinary(global::System.Linq.Expressions.ExpressionType.AddChecked, expr_1, expr_2);
return global::System.Linq.Expressions.Expression.Lambda>(expr_0, p__this);
}
diff --git a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/CheckedArithmeticTests.CheckedConversion.verified.txt b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/CheckedArithmeticTests.CheckedConversion.verified.txt
index b2f35fe..3548082 100644
--- a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/CheckedArithmeticTests.CheckedConversion.verified.txt
+++ b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/CheckedArithmeticTests.CheckedConversion.verified.txt
@@ -5,17 +5,14 @@ using Foo;
namespace ExpressiveSharp.Generated
{
- [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
- static class Foo_C_Truncated
+ static partial class Foo_C
{
- private static readonly global::System.Reflection.PropertyInfo _p0 = typeof(global::Foo.C).GetProperty("Value");
-
// [Expressive]
// public int Truncated => checked((int)Value);
- static global::System.Linq.Expressions.Expression> Expression()
+ static global::System.Linq.Expressions.Expression> Truncated_Expression()
{
var p__this = global::System.Linq.Expressions.Expression.Parameter(typeof(global::Foo.C), "@this");
- var expr_1 = global::System.Linq.Expressions.Expression.Property(p__this, _p0); // Value
+ var expr_1 = global::System.Linq.Expressions.Expression.Property(p__this, typeof(global::Foo.C).GetProperty("Value")); // Value
var expr_0 = global::System.Linq.Expressions.Expression.ConvertChecked(expr_1, typeof(int));
return global::System.Linq.Expressions.Expression.Lambda>(expr_0, p__this);
}
diff --git a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/CheckedArithmeticTests.CheckedMultiplication.verified.txt b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/CheckedArithmeticTests.CheckedMultiplication.verified.txt
index 221cff9..4f4c0d0 100644
--- a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/CheckedArithmeticTests.CheckedMultiplication.verified.txt
+++ b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/CheckedArithmeticTests.CheckedMultiplication.verified.txt
@@ -5,19 +5,15 @@ using Foo;
namespace ExpressiveSharp.Generated
{
- [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
- static class Foo_C_Product
+ static partial class Foo_C
{
- private static readonly global::System.Reflection.PropertyInfo _p0 = typeof(global::Foo.C).GetProperty("A");
- private static readonly global::System.Reflection.PropertyInfo _p1 = typeof(global::Foo.C).GetProperty("B");
-
// [Expressive]
// public int Product => checked(A * B);
- static global::System.Linq.Expressions.Expression> Expression()
+ static global::System.Linq.Expressions.Expression> Product_Expression()
{
var p__this = global::System.Linq.Expressions.Expression.Parameter(typeof(global::Foo.C), "@this");
- var expr_1 = global::System.Linq.Expressions.Expression.Property(p__this, _p0); // A
- var expr_2 = global::System.Linq.Expressions.Expression.Property(p__this, _p1); // B
+ var expr_1 = global::System.Linq.Expressions.Expression.Property(p__this, typeof(global::Foo.C).GetProperty("A")); // A
+ var expr_2 = global::System.Linq.Expressions.Expression.Property(p__this, typeof(global::Foo.C).GetProperty("B")); // B
var expr_0 = global::System.Linq.Expressions.Expression.MakeBinary(global::System.Linq.Expressions.ExpressionType.MultiplyChecked, expr_1, expr_2);
return global::System.Linq.Expressions.Expression.Lambda>(expr_0, p__this);
}
diff --git a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/CheckedArithmeticTests.CheckedNegation.verified.txt b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/CheckedArithmeticTests.CheckedNegation.verified.txt
index 6eae859..cc7d04b 100644
--- a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/CheckedArithmeticTests.CheckedNegation.verified.txt
+++ b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/CheckedArithmeticTests.CheckedNegation.verified.txt
@@ -5,17 +5,14 @@ using Foo;
namespace ExpressiveSharp.Generated
{
- [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
- static class Foo_C_Negated
+ static partial class Foo_C
{
- private static readonly global::System.Reflection.PropertyInfo _p0 = typeof(global::Foo.C).GetProperty("A");
-
// [Expressive]
// public int Negated => checked(-A);
- static global::System.Linq.Expressions.Expression> Expression()
+ static global::System.Linq.Expressions.Expression> Negated_Expression()
{
var p__this = global::System.Linq.Expressions.Expression.Parameter(typeof(global::Foo.C), "@this");
- var expr_1 = global::System.Linq.Expressions.Expression.Property(p__this, _p0); // A
+ var expr_1 = global::System.Linq.Expressions.Expression.Property(p__this, typeof(global::Foo.C).GetProperty("A")); // A
var expr_0 = global::System.Linq.Expressions.Expression.MakeUnary(global::System.Linq.Expressions.ExpressionType.NegateChecked, expr_1, typeof(int));
return global::System.Linq.Expressions.Expression.Lambda>(expr_0, p__this);
}
diff --git a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/CheckedArithmeticTests.CheckedSubtraction.verified.txt b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/CheckedArithmeticTests.CheckedSubtraction.verified.txt
index 4542caf..ac19225 100644
--- a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/CheckedArithmeticTests.CheckedSubtraction.verified.txt
+++ b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/CheckedArithmeticTests.CheckedSubtraction.verified.txt
@@ -5,19 +5,15 @@ using Foo;
namespace ExpressiveSharp.Generated
{
- [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
- static class Foo_C_Diff
+ static partial class Foo_C
{
- private static readonly global::System.Reflection.PropertyInfo _p0 = typeof(global::Foo.C).GetProperty("A");
- private static readonly global::System.Reflection.PropertyInfo _p1 = typeof(global::Foo.C).GetProperty("B");
-
// [Expressive]
// public int Diff => checked(A - B);
- static global::System.Linq.Expressions.Expression> Expression()
+ static global::System.Linq.Expressions.Expression> Diff_Expression()
{
var p__this = global::System.Linq.Expressions.Expression.Parameter(typeof(global::Foo.C), "@this");
- var expr_1 = global::System.Linq.Expressions.Expression.Property(p__this, _p0); // A
- var expr_2 = global::System.Linq.Expressions.Expression.Property(p__this, _p1); // B
+ var expr_1 = global::System.Linq.Expressions.Expression.Property(p__this, typeof(global::Foo.C).GetProperty("A")); // A
+ var expr_2 = global::System.Linq.Expressions.Expression.Property(p__this, typeof(global::Foo.C).GetProperty("B")); // B
var expr_0 = global::System.Linq.Expressions.Expression.MakeBinary(global::System.Linq.Expressions.ExpressionType.SubtractChecked, expr_1, expr_2);
return global::System.Linq.Expressions.Expression.Lambda>(expr_0, p__this);
}
diff --git a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/CollectionExpressionTests.CollectionExpression_Array.verified.txt b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/CollectionExpressionTests.CollectionExpression_Array.verified.txt
index fda8102..164a7eb 100644
--- a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/CollectionExpressionTests.CollectionExpression_Array.verified.txt
+++ b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/CollectionExpressionTests.CollectionExpression_Array.verified.txt
@@ -5,12 +5,11 @@ using Foo;
namespace ExpressiveSharp.Generated
{
- [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
- static class Foo_C_Numbers
+ static partial class Foo_C
{
// [Expressive]
// public int[] Numbers => [1, 2, 3];
- static global::System.Linq.Expressions.Expression> Expression()
+ static global::System.Linq.Expressions.Expression> Numbers_Expression()
{
var p__this = global::System.Linq.Expressions.Expression.Parameter(typeof(global::Foo.C), "@this");
var expr_1 = global::System.Linq.Expressions.Expression.Constant(1, typeof(int)); // 1
diff --git a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/CollectionExpressionTests.CollectionExpression_ArrayWithSpread.verified.txt b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/CollectionExpressionTests.CollectionExpression_ArrayWithSpread.verified.txt
index c2e9470..6e24d8f 100644
--- a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/CollectionExpressionTests.CollectionExpression_ArrayWithSpread.verified.txt
+++ b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/CollectionExpressionTests.CollectionExpression_ArrayWithSpread.verified.txt
@@ -5,26 +5,21 @@ using Foo;
namespace ExpressiveSharp.Generated
{
- [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
- static class Foo_C_Combined
+ static partial class Foo_C
{
- private static readonly global::System.Reflection.MethodInfo _m0 = global::System.Linq.Enumerable.First(global::System.Linq.Enumerable.Where(typeof(global::System.Linq.Enumerable).GetMethods(global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static), m => m.Name == "ToArray" && m.IsGenericMethodDefinition && m.GetGenericArguments().Length == 1 && m.GetParameters().Length == 1)).MakeGenericMethod(typeof(int));
- private static readonly global::System.Reflection.PropertyInfo _p0 = typeof(global::Foo.C).GetProperty("Items");
- private static readonly global::System.Reflection.MethodInfo _m1 = global::System.Linq.Enumerable.First(global::System.Linq.Enumerable.Where(typeof(global::System.Linq.Enumerable).GetMethods(global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static), m => m.Name == "Concat" && m.IsGenericMethodDefinition && m.GetGenericArguments().Length == 1 && m.GetParameters().Length == 2)).MakeGenericMethod(typeof(int));
-
// [Expressive]
// public int[] Combined => [1, ..Items, 2];
- static global::System.Linq.Expressions.Expression> Expression()
+ static global::System.Linq.Expressions.Expression> Combined_Expression()
{
var p__this = global::System.Linq.Expressions.Expression.Parameter(typeof(global::Foo.C), "@this");
var expr_1 = global::System.Linq.Expressions.Expression.Constant(1, typeof(int)); // 1
var expr_2 = global::System.Linq.Expressions.Expression.NewArrayInit(typeof(int), expr_1);
- var expr_3 = global::System.Linq.Expressions.Expression.Property(p__this, _p0); // Items
+ var expr_3 = global::System.Linq.Expressions.Expression.Property(p__this, typeof(global::Foo.C).GetProperty("Items")); // Items
var expr_4 = global::System.Linq.Expressions.Expression.Constant(2, typeof(int)); // 2
var expr_5 = global::System.Linq.Expressions.Expression.NewArrayInit(typeof(int), expr_4);
- var expr_6 = global::System.Linq.Expressions.Expression.Call(_m1, expr_2, expr_3);
- var expr_7 = global::System.Linq.Expressions.Expression.Call(_m1, expr_6, expr_5);
- var expr_0 = global::System.Linq.Expressions.Expression.Call(_m0, expr_7);
+ var expr_6 = global::System.Linq.Expressions.Expression.Call(global::System.Linq.Enumerable.First(global::System.Linq.Enumerable.Where(typeof(global::System.Linq.Enumerable).GetMethods(global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static), m => m.Name == "Concat" && m.IsGenericMethodDefinition && m.GetGenericArguments().Length == 1 && m.GetParameters().Length == 2)).MakeGenericMethod(typeof(int)), expr_2, expr_3);
+ var expr_7 = global::System.Linq.Expressions.Expression.Call(global::System.Linq.Enumerable.First(global::System.Linq.Enumerable.Where(typeof(global::System.Linq.Enumerable).GetMethods(global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static), m => m.Name == "Concat" && m.IsGenericMethodDefinition && m.GetGenericArguments().Length == 1 && m.GetParameters().Length == 2)).MakeGenericMethod(typeof(int)), expr_6, expr_5);
+ var expr_0 = global::System.Linq.Expressions.Expression.Call(global::System.Linq.Enumerable.First(global::System.Linq.Enumerable.Where(typeof(global::System.Linq.Enumerable).GetMethods(global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static), m => m.Name == "ToArray" && m.IsGenericMethodDefinition && m.GetGenericArguments().Length == 1 && m.GetParameters().Length == 1)).MakeGenericMethod(typeof(int)), expr_7);
return global::System.Linq.Expressions.Expression.Lambda>(expr_0, p__this);
}
}
diff --git a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/CollectionExpressionTests.CollectionExpression_ListWithSpread.verified.txt b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/CollectionExpressionTests.CollectionExpression_ListWithSpread.verified.txt
index e59ee12..9652f48 100644
--- a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/CollectionExpressionTests.CollectionExpression_ListWithSpread.verified.txt
+++ b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/CollectionExpressionTests.CollectionExpression_ListWithSpread.verified.txt
@@ -5,26 +5,21 @@ using Foo;
namespace ExpressiveSharp.Generated
{
- [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
- static class Foo_C_Combined
+ static partial class Foo_C
{
- private static readonly global::System.Reflection.MethodInfo _m0 = global::System.Linq.Enumerable.First(global::System.Linq.Enumerable.Where(typeof(global::System.Linq.Enumerable).GetMethods(global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static), m => m.Name == "ToList" && m.IsGenericMethodDefinition && m.GetGenericArguments().Length == 1 && m.GetParameters().Length == 1)).MakeGenericMethod(typeof(int));
- private static readonly global::System.Reflection.PropertyInfo _p0 = typeof(global::Foo.C).GetProperty("Items");
- private static readonly global::System.Reflection.MethodInfo _m1 = global::System.Linq.Enumerable.First(global::System.Linq.Enumerable.Where(typeof(global::System.Linq.Enumerable).GetMethods(global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static), m => m.Name == "Concat" && m.IsGenericMethodDefinition && m.GetGenericArguments().Length == 1 && m.GetParameters().Length == 2)).MakeGenericMethod(typeof(int));
-
// [Expressive]
// public List Combined => [1, ..Items, 2];
- static global::System.Linq.Expressions.Expression>> Expression()
+ static global::System.Linq.Expressions.Expression>> Combined_Expression()
{
var p__this = global::System.Linq.Expressions.Expression.Parameter(typeof(global::Foo.C), "@this");
var expr_1 = global::System.Linq.Expressions.Expression.Constant(1, typeof(int)); // 1
var expr_2 = global::System.Linq.Expressions.Expression.NewArrayInit(typeof(int), expr_1);
- var expr_3 = global::System.Linq.Expressions.Expression.Property(p__this, _p0); // Items
+ var expr_3 = global::System.Linq.Expressions.Expression.Property(p__this, typeof(global::Foo.C).GetProperty("Items")); // Items
var expr_4 = global::System.Linq.Expressions.Expression.Constant(2, typeof(int)); // 2
var expr_5 = global::System.Linq.Expressions.Expression.NewArrayInit(typeof(int), expr_4);
- var expr_6 = global::System.Linq.Expressions.Expression.Call(_m1, expr_2, expr_3);
- var expr_7 = global::System.Linq.Expressions.Expression.Call(_m1, expr_6, expr_5);
- var expr_0 = global::System.Linq.Expressions.Expression.Call(_m0, expr_7);
+ var expr_6 = global::System.Linq.Expressions.Expression.Call(global::System.Linq.Enumerable.First(global::System.Linq.Enumerable.Where(typeof(global::System.Linq.Enumerable).GetMethods(global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static), m => m.Name == "Concat" && m.IsGenericMethodDefinition && m.GetGenericArguments().Length == 1 && m.GetParameters().Length == 2)).MakeGenericMethod(typeof(int)), expr_2, expr_3);
+ var expr_7 = global::System.Linq.Expressions.Expression.Call(global::System.Linq.Enumerable.First(global::System.Linq.Enumerable.Where(typeof(global::System.Linq.Enumerable).GetMethods(global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static), m => m.Name == "Concat" && m.IsGenericMethodDefinition && m.GetGenericArguments().Length == 1 && m.GetParameters().Length == 2)).MakeGenericMethod(typeof(int)), expr_6, expr_5);
+ var expr_0 = global::System.Linq.Expressions.Expression.Call(global::System.Linq.Enumerable.First(global::System.Linq.Enumerable.Where(typeof(global::System.Linq.Enumerable).GetMethods(global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static), m => m.Name == "ToList" && m.IsGenericMethodDefinition && m.GetGenericArguments().Length == 1 && m.GetParameters().Length == 1)).MakeGenericMethod(typeof(int)), expr_7);
return global::System.Linq.Expressions.Expression.Lambda>>(expr_0, p__this);
}
}
diff --git a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/CollectionExpressionTests.CollectionExpression_MultipleSpreads.verified.txt b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/CollectionExpressionTests.CollectionExpression_MultipleSpreads.verified.txt
index 660774c..c528328 100644
--- a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/CollectionExpressionTests.CollectionExpression_MultipleSpreads.verified.txt
+++ b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/CollectionExpressionTests.CollectionExpression_MultipleSpreads.verified.txt
@@ -5,23 +5,17 @@ using Foo;
namespace ExpressiveSharp.Generated
{
- [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
- static class Foo_C_All
+ static partial class Foo_C
{
- private static readonly global::System.Reflection.MethodInfo _m0 = global::System.Linq.Enumerable.First(global::System.Linq.Enumerable.Where(typeof(global::System.Linq.Enumerable).GetMethods(global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static), m => m.Name == "ToArray" && m.IsGenericMethodDefinition && m.GetGenericArguments().Length == 1 && m.GetParameters().Length == 1)).MakeGenericMethod(typeof(int));
- private static readonly global::System.Reflection.PropertyInfo _p0 = typeof(global::Foo.C).GetProperty("Items");
- private static readonly global::System.Reflection.PropertyInfo _p1 = typeof(global::Foo.C).GetProperty("Others");
- private static readonly global::System.Reflection.MethodInfo _m1 = global::System.Linq.Enumerable.First(global::System.Linq.Enumerable.Where(typeof(global::System.Linq.Enumerable).GetMethods(global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static), m => m.Name == "Concat" && m.IsGenericMethodDefinition && m.GetGenericArguments().Length == 1 && m.GetParameters().Length == 2)).MakeGenericMethod(typeof(int));
-
// [Expressive]
// public int[] All => [..Items, ..Others];
- static global::System.Linq.Expressions.Expression> Expression()
+ static global::System.Linq.Expressions.Expression> All_Expression()
{
var p__this = global::System.Linq.Expressions.Expression.Parameter(typeof(global::Foo.C), "@this");
- var expr_1 = global::System.Linq.Expressions.Expression.Property(p__this, _p0); // Items
- var expr_2 = global::System.Linq.Expressions.Expression.Property(p__this, _p1); // Others
- var expr_3 = global::System.Linq.Expressions.Expression.Call(_m1, expr_1, expr_2);
- var expr_0 = global::System.Linq.Expressions.Expression.Call(_m0, expr_3);
+ var expr_1 = global::System.Linq.Expressions.Expression.Property(p__this, typeof(global::Foo.C).GetProperty("Items")); // Items
+ var expr_2 = global::System.Linq.Expressions.Expression.Property(p__this, typeof(global::Foo.C).GetProperty("Others")); // Others
+ var expr_3 = global::System.Linq.Expressions.Expression.Call(global::System.Linq.Enumerable.First(global::System.Linq.Enumerable.Where(typeof(global::System.Linq.Enumerable).GetMethods(global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static), m => m.Name == "Concat" && m.IsGenericMethodDefinition && m.GetGenericArguments().Length == 1 && m.GetParameters().Length == 2)).MakeGenericMethod(typeof(int)), expr_1, expr_2);
+ var expr_0 = global::System.Linq.Expressions.Expression.Call(global::System.Linq.Enumerable.First(global::System.Linq.Enumerable.Where(typeof(global::System.Linq.Enumerable).GetMethods(global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static), m => m.Name == "ToArray" && m.IsGenericMethodDefinition && m.GetGenericArguments().Length == 1 && m.GetParameters().Length == 1)).MakeGenericMethod(typeof(int)), expr_3);
return global::System.Linq.Expressions.Expression.Lambda>(expr_0, p__this);
}
}
diff --git a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/CollectionExpressionTests.CollectionExpression_SpreadOnly.verified.txt b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/CollectionExpressionTests.CollectionExpression_SpreadOnly.verified.txt
index 95a8616..3c87ebc 100644
--- a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/CollectionExpressionTests.CollectionExpression_SpreadOnly.verified.txt
+++ b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/CollectionExpressionTests.CollectionExpression_SpreadOnly.verified.txt
@@ -5,19 +5,15 @@ using Foo;
namespace ExpressiveSharp.Generated
{
- [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
- static class Foo_C_Copy
+ static partial class Foo_C
{
- private static readonly global::System.Reflection.MethodInfo _m0 = global::System.Linq.Enumerable.First(global::System.Linq.Enumerable.Where(typeof(global::System.Linq.Enumerable).GetMethods(global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static), m => m.Name == "ToArray" && m.IsGenericMethodDefinition && m.GetGenericArguments().Length == 1 && m.GetParameters().Length == 1)).MakeGenericMethod(typeof(int));
- private static readonly global::System.Reflection.PropertyInfo _p0 = typeof(global::Foo.C).GetProperty("Items");
-
// [Expressive]
// public int[] Copy => [..Items];
- static global::System.Linq.Expressions.Expression> Expression()
+ static global::System.Linq.Expressions.Expression> Copy_Expression()
{
var p__this = global::System.Linq.Expressions.Expression.Parameter(typeof(global::Foo.C), "@this");
- var expr_1 = global::System.Linq.Expressions.Expression.Property(p__this, _p0); // Items
- var expr_0 = global::System.Linq.Expressions.Expression.Call(_m0, expr_1);
+ var expr_1 = global::System.Linq.Expressions.Expression.Property(p__this, typeof(global::Foo.C).GetProperty("Items")); // Items
+ var expr_0 = global::System.Linq.Expressions.Expression.Call(global::System.Linq.Enumerable.First(global::System.Linq.Enumerable.Where(typeof(global::System.Linq.Enumerable).GetMethods(global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static), m => m.Name == "ToArray" && m.IsGenericMethodDefinition && m.GetGenericArguments().Length == 1 && m.GetParameters().Length == 1)).MakeGenericMethod(typeof(int)), expr_1);
return global::System.Linq.Expressions.Expression.Lambda>(expr_0, p__this);
}
}
diff --git a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/CollectionExpressionTests.CollectionInitializer_DictionaryAdd.verified.txt b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/CollectionExpressionTests.CollectionInitializer_DictionaryAdd.verified.txt
index 31b0f67..65940d6 100644
--- a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/CollectionExpressionTests.CollectionInitializer_DictionaryAdd.verified.txt
+++ b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/CollectionExpressionTests.CollectionInitializer_DictionaryAdd.verified.txt
@@ -5,12 +5,8 @@ using Foo;
namespace ExpressiveSharp.Generated
{
- [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
- static class Foo_C_Map
+ static partial class Foo_C
{
- private static readonly global::System.Reflection.ConstructorInfo _c0 = typeof(global::System.Collections.Generic.Dictionary).GetConstructor(new global::System.Type[] { });
- private static readonly global::System.Reflection.MethodInfo _m0 = typeof(global::System.Collections.Generic.Dictionary).GetMethod("Add", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string), typeof(int) }, null);
-
// [Expressive]
// public Dictionary Map => new Dictionary
// {
@@ -23,16 +19,16 @@ namespace ExpressiveSharp.Generated
// 2
// }
// };
- static global::System.Linq.Expressions.Expression>> Expression()
+ static global::System.Linq.Expressions.Expression>> Map_Expression()
{
var p__this = global::System.Linq.Expressions.Expression.Parameter(typeof(global::Foo.C), "@this");
- var expr_1 = global::System.Linq.Expressions.Expression.New(_c0); // new Dictionary { { "a", 1 }, { "b", 2 } }
+ var expr_1 = global::System.Linq.Expressions.Expression.New(typeof(global::System.Collections.Generic.Dictionary).GetConstructor(new global::System.Type[] { })); // new Dictionary { { "a", 1 }, { "b", 2 } }
var expr_2 = global::System.Linq.Expressions.Expression.Constant("a", typeof(string)); // "a"
var expr_3 = global::System.Linq.Expressions.Expression.Constant(1, typeof(int)); // 1
- var expr_4 = global::System.Linq.Expressions.Expression.ElementInit(_m0, expr_2, expr_3);
+ var expr_4 = global::System.Linq.Expressions.Expression.ElementInit(typeof(global::System.Collections.Generic.Dictionary).GetMethod("Add", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string), typeof(int) }, null), expr_2, expr_3);
var expr_5 = global::System.Linq.Expressions.Expression.Constant("b", typeof(string)); // "b"
var expr_6 = global::System.Linq.Expressions.Expression.Constant(2, typeof(int)); // 2
- var expr_7 = global::System.Linq.Expressions.Expression.ElementInit(_m0, expr_5, expr_6);
+ var expr_7 = global::System.Linq.Expressions.Expression.ElementInit(typeof(global::System.Collections.Generic.Dictionary).GetMethod("Add", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string), typeof(int) }, null), expr_5, expr_6);
var expr_0 = global::System.Linq.Expressions.Expression.ListInit(expr_1, expr_4, expr_7);
return global::System.Linq.Expressions.Expression.Lambda>>(expr_0, p__this);
}
diff --git a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/CollectionExpressionTests.CollectionInitializer_ListOfInt.verified.txt b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/CollectionExpressionTests.CollectionInitializer_ListOfInt.verified.txt
index 12c2448..da5af91 100644
--- a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/CollectionExpressionTests.CollectionInitializer_ListOfInt.verified.txt
+++ b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/CollectionExpressionTests.CollectionInitializer_ListOfInt.verified.txt
@@ -5,12 +5,8 @@ using Foo;
namespace ExpressiveSharp.Generated
{
- [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
- static class Foo_C_Numbers
+ static partial class Foo_C
{
- private static readonly global::System.Reflection.ConstructorInfo _c0 = typeof(global::System.Collections.Generic.List).GetConstructor(new global::System.Type[] { });
- private static readonly global::System.Reflection.MethodInfo _m0 = typeof(global::System.Collections.Generic.List).GetMethod("Add", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null);
-
// [Expressive]
// public List Numbers => new List
// {
@@ -18,16 +14,16 @@ namespace ExpressiveSharp.Generated
// 2,
// 3
// };
- static global::System.Linq.Expressions.Expression>> Expression()
+ static global::System.Linq.Expressions.Expression>> Numbers_Expression()
{
var p__this = global::System.Linq.Expressions.Expression.Parameter(typeof(global::Foo.C), "@this");
- var expr_1 = global::System.Linq.Expressions.Expression.New(_c0); // new List { 1, 2, 3 }
+ var expr_1 = global::System.Linq.Expressions.Expression.New(typeof(global::System.Collections.Generic.List).GetConstructor(new global::System.Type[] { })); // new List { 1, 2, 3 }
var expr_2 = global::System.Linq.Expressions.Expression.Constant(1, typeof(int)); // 1
- var expr_3 = global::System.Linq.Expressions.Expression.ElementInit(_m0, expr_2);
+ var expr_3 = global::System.Linq.Expressions.Expression.ElementInit(typeof(global::System.Collections.Generic.List).GetMethod("Add", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null), expr_2);
var expr_4 = global::System.Linq.Expressions.Expression.Constant(2, typeof(int)); // 2
- var expr_5 = global::System.Linq.Expressions.Expression.ElementInit(_m0, expr_4);
+ var expr_5 = global::System.Linq.Expressions.Expression.ElementInit(typeof(global::System.Collections.Generic.List).GetMethod("Add", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null), expr_4);
var expr_6 = global::System.Linq.Expressions.Expression.Constant(3, typeof(int)); // 3
- var expr_7 = global::System.Linq.Expressions.Expression.ElementInit(_m0, expr_6);
+ var expr_7 = global::System.Linq.Expressions.Expression.ElementInit(typeof(global::System.Collections.Generic.List).GetMethod("Add", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null), expr_6);
var expr_0 = global::System.Linq.Expressions.Expression.ListInit(expr_1, expr_3, expr_5, expr_7);
return global::System.Linq.Expressions.Expression.Lambda>>(expr_0, p__this);
}
diff --git a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_BodyAssignments.verified.txt b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_BodyAssignments.verified.txt
index bd7c1ad..50a91c4 100644
--- a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_BodyAssignments.verified.txt
+++ b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_BodyAssignments.verified.txt
@@ -5,26 +5,21 @@ using Foo;
namespace ExpressiveSharp.Generated
{
- [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
- static class Foo_PointDto__ctor_P0_int_P1_int
+ static partial class Foo_PointDto
{
- private static readonly global::System.Reflection.ConstructorInfo _c0 = typeof(global::Foo.PointDto).GetConstructor(new global::System.Type[] { });
- private static readonly global::System.Reflection.PropertyInfo _p0 = typeof(global::Foo.PointDto).GetProperty("X");
- private static readonly global::System.Reflection.PropertyInfo _p1 = typeof(global::Foo.PointDto).GetProperty("Y");
-
// [Expressive]
// public PointDto(int x, int y)
// {
// X = x;
// Y = y;
// }
- static global::System.Linq.Expressions.Expression> Expression()
+ static global::System.Linq.Expressions.Expression> _ctor_P0_int_P1_int_Expression()
{
var p_x = global::System.Linq.Expressions.Expression.Parameter(typeof(int), "x");
var p_y = global::System.Linq.Expressions.Expression.Parameter(typeof(int), "y");
- var expr_0 = global::System.Linq.Expressions.Expression.New(_c0);
- var expr_1 = global::System.Linq.Expressions.Expression.Bind(_p0, p_x);
- var expr_2 = global::System.Linq.Expressions.Expression.Bind(_p1, p_y);
+ var expr_0 = global::System.Linq.Expressions.Expression.New(typeof(global::Foo.PointDto).GetConstructor(new global::System.Type[] { }));
+ var expr_1 = global::System.Linq.Expressions.Expression.Bind(typeof(global::Foo.PointDto).GetProperty("X"), p_x);
+ var expr_2 = global::System.Linq.Expressions.Expression.Bind(typeof(global::Foo.PointDto).GetProperty("Y"), p_y);
var expr_3 = global::System.Linq.Expressions.Expression.MemberInit(expr_0, expr_1, expr_2);
return global::System.Linq.Expressions.Expression.Lambda>(expr_3, p_x, p_y);
}
diff --git a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_Overloads.verified.txt b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_Overloads.verified.txt
index 5c24bc2..a8cdaea 100644
--- a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_Overloads.verified.txt
+++ b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_Overloads.verified.txt
@@ -6,26 +6,21 @@ using Foo;
namespace ExpressiveSharp.Generated
{
- [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
- static class Foo_PersonDto__ctor_P0_string_P1_string
+ static partial class Foo_PersonDto
{
- private static readonly global::System.Reflection.ConstructorInfo _c0 = typeof(global::Foo.PersonDto).GetConstructor(new global::System.Type[] { });
- private static readonly global::System.Reflection.PropertyInfo _p0 = typeof(global::Foo.PersonDto).GetProperty("FirstName");
- private static readonly global::System.Reflection.PropertyInfo _p1 = typeof(global::Foo.PersonDto).GetProperty("LastName");
-
// [Expressive]
// public PersonDto(string firstName, string lastName)
// {
// FirstName = firstName;
// LastName = lastName;
// }
- static global::System.Linq.Expressions.Expression> Expression()
+ static global::System.Linq.Expressions.Expression> _ctor_P0_string_P1_string_Expression()
{
var p_firstName = global::System.Linq.Expressions.Expression.Parameter(typeof(string), "firstName");
var p_lastName = global::System.Linq.Expressions.Expression.Parameter(typeof(string), "lastName");
- var expr_0 = global::System.Linq.Expressions.Expression.New(_c0);
- var expr_1 = global::System.Linq.Expressions.Expression.Bind(_p0, p_firstName);
- var expr_2 = global::System.Linq.Expressions.Expression.Bind(_p1, p_lastName);
+ var expr_0 = global::System.Linq.Expressions.Expression.New(typeof(global::Foo.PersonDto).GetConstructor(new global::System.Type[] { }));
+ var expr_1 = global::System.Linq.Expressions.Expression.Bind(typeof(global::Foo.PersonDto).GetProperty("FirstName"), p_firstName);
+ var expr_2 = global::System.Linq.Expressions.Expression.Bind(typeof(global::Foo.PersonDto).GetProperty("LastName"), p_lastName);
var expr_3 = global::System.Linq.Expressions.Expression.MemberInit(expr_0, expr_1, expr_2);
return global::System.Linq.Expressions.Expression.Lambda>(expr_3, p_firstName, p_lastName);
}
@@ -40,27 +35,21 @@ using Foo;
namespace ExpressiveSharp.Generated
{
- [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
- static class Foo_PersonDto__ctor_P0_string
+ static partial class Foo_PersonDto
{
- private static readonly global::System.Reflection.ConstructorInfo _c0 = typeof(global::Foo.PersonDto).GetConstructor(new global::System.Type[] { });
- private static readonly global::System.Reflection.FieldInfo _f0 = typeof(string).GetField("Empty", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static);
- private static readonly global::System.Reflection.PropertyInfo _p0 = typeof(global::Foo.PersonDto).GetProperty("FirstName");
- private static readonly global::System.Reflection.PropertyInfo _p1 = typeof(global::Foo.PersonDto).GetProperty("LastName");
-
// [Expressive]
// public PersonDto(string fullName)
// {
// FirstName = fullName;
// LastName = string.Empty;
// }
- static global::System.Linq.Expressions.Expression> Expression()
+ static global::System.Linq.Expressions.Expression> _ctor_P0_string_Expression()
{
var p_fullName = global::System.Linq.Expressions.Expression.Parameter(typeof(string), "fullName");
- var expr_0 = global::System.Linq.Expressions.Expression.New(_c0);
- var expr_1 = global::System.Linq.Expressions.Expression.Field(null, _f0); // string.Empty
- var expr_2 = global::System.Linq.Expressions.Expression.Bind(_p0, p_fullName);
- var expr_3 = global::System.Linq.Expressions.Expression.Bind(_p1, expr_1);
+ var expr_0 = global::System.Linq.Expressions.Expression.New(typeof(global::Foo.PersonDto).GetConstructor(new global::System.Type[] { }));
+ var expr_1 = global::System.Linq.Expressions.Expression.Field(null, typeof(string).GetField("Empty", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static)); // string.Empty
+ var expr_2 = global::System.Linq.Expressions.Expression.Bind(typeof(global::Foo.PersonDto).GetProperty("FirstName"), p_fullName);
+ var expr_3 = global::System.Linq.Expressions.Expression.Bind(typeof(global::Foo.PersonDto).GetProperty("LastName"), expr_1);
var expr_4 = global::System.Linq.Expressions.Expression.MemberInit(expr_0, expr_2, expr_3);
return global::System.Linq.Expressions.Expression.Lambda>(expr_4, p_fullName);
}
diff --git a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_ReferencingBasePropertyInDerivedBody.verified.txt b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_ReferencingBasePropertyInDerivedBody.verified.txt
index 84f90a4..97c99dc 100644
--- a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_ReferencingBasePropertyInDerivedBody.verified.txt
+++ b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_ReferencingBasePropertyInDerivedBody.verified.txt
@@ -5,30 +5,24 @@ using Foo;
namespace ExpressiveSharp.Generated
{
- [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
- static class Foo_Child__ctor_P0_string
+ static partial class Foo_Child
{
- private static readonly global::System.Reflection.ConstructorInfo _c0 = typeof(global::Foo.Child).GetConstructor(new global::System.Type[] { });
- private static readonly global::System.Reflection.PropertyInfo _p0 = typeof(global::Foo.Base).GetProperty("Code");
- private static readonly global::System.Reflection.MethodInfo _m0 = typeof(string).GetMethod("Concat", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(string), typeof(string) }, null);
- private static readonly global::System.Reflection.PropertyInfo _p1 = typeof(global::Foo.Child).GetProperty("Label");
-
// [Expressive]
// public Child(string code) : base(code)
// {
// Label = "[" + Code + "]";
// }
- static global::System.Linq.Expressions.Expression> Expression()
+ static global::System.Linq.Expressions.Expression> _ctor_P0_string_Expression()
{
var p_code = global::System.Linq.Expressions.Expression.Parameter(typeof(string), "code");
- var expr_0 = global::System.Linq.Expressions.Expression.New(_c0);
+ var expr_0 = global::System.Linq.Expressions.Expression.New(typeof(global::Foo.Child).GetConstructor(new global::System.Type[] { }));
var expr_3 = global::System.Linq.Expressions.Expression.Constant("[", typeof(string)); // "["
var p___this = global::System.Linq.Expressions.Expression.Parameter(typeof(object), "@this"); // Code
- var expr_4 = global::System.Linq.Expressions.Expression.Property(p___this, _p0);
- var expr_2 = global::System.Linq.Expressions.Expression.Call(_m0, expr_3, expr_4);
+ var expr_4 = global::System.Linq.Expressions.Expression.Property(p___this, typeof(global::Foo.Base).GetProperty("Code"));
+ var expr_2 = global::System.Linq.Expressions.Expression.Call(typeof(string).GetMethod("Concat", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(string), typeof(string) }, null), expr_3, expr_4);
var expr_5 = global::System.Linq.Expressions.Expression.Constant("]", typeof(string)); // "]"
- var expr_1 = global::System.Linq.Expressions.Expression.Call(_m0, expr_2, expr_5);
- var expr_6 = global::System.Linq.Expressions.Expression.Bind(_p1, expr_1);
+ var expr_1 = global::System.Linq.Expressions.Expression.Call(typeof(string).GetMethod("Concat", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(string), typeof(string) }, null), expr_2, expr_5);
+ var expr_6 = global::System.Linq.Expressions.Expression.Bind(typeof(global::Foo.Child).GetProperty("Label"), expr_1);
var expr_7 = global::System.Linq.Expressions.Expression.MemberInit(expr_0, expr_6);
return global::System.Linq.Expressions.Expression.Lambda>(expr_7, p_code);
}
diff --git a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_ReferencingPreviouslyAssignedInBaseCtor.verified.txt b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_ReferencingPreviouslyAssignedInBaseCtor.verified.txt
index 70d97fa..926f2e0 100644
--- a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_ReferencingPreviouslyAssignedInBaseCtor.verified.txt
+++ b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_ReferencingPreviouslyAssignedInBaseCtor.verified.txt
@@ -5,29 +5,23 @@ using Foo;
namespace ExpressiveSharp.Generated
{
- [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
- static class Foo_Child__ctor_P0_int_P1_int
+ static partial class Foo_Child
{
- private static readonly global::System.Reflection.ConstructorInfo _c0 = typeof(global::Foo.Child).GetConstructor(new global::System.Type[] { });
- private static readonly global::System.Reflection.PropertyInfo _p0 = typeof(global::Foo.Base).GetProperty("X");
- private static readonly global::System.Reflection.PropertyInfo _p1 = typeof(global::Foo.Base).GetProperty("Y");
- private static readonly global::System.Reflection.PropertyInfo _p2 = typeof(global::Foo.Child).GetProperty("Sum");
-
// [Expressive]
// public Child(int a, int b) : base(a, b)
// {
// Sum = X + Y;
// }
- static global::System.Linq.Expressions.Expression> Expression()
+ static global::System.Linq.Expressions.Expression> _ctor_P0_int_P1_int_Expression()
{
var p_a = global::System.Linq.Expressions.Expression.Parameter(typeof(int), "a");
var p_b = global::System.Linq.Expressions.Expression.Parameter(typeof(int), "b");
- var expr_0 = global::System.Linq.Expressions.Expression.New(_c0);
+ var expr_0 = global::System.Linq.Expressions.Expression.New(typeof(global::Foo.Child).GetConstructor(new global::System.Type[] { }));
var p___this = global::System.Linq.Expressions.Expression.Parameter(typeof(object), "@this"); // X
- var expr_2 = global::System.Linq.Expressions.Expression.Property(p___this, _p0);
- var expr_3 = global::System.Linq.Expressions.Expression.Property(p___this, _p1); // Y
+ var expr_2 = global::System.Linq.Expressions.Expression.Property(p___this, typeof(global::Foo.Base).GetProperty("X"));
+ var expr_3 = global::System.Linq.Expressions.Expression.Property(p___this, typeof(global::Foo.Base).GetProperty("Y")); // Y
var expr_1 = global::System.Linq.Expressions.Expression.MakeBinary(global::System.Linq.Expressions.ExpressionType.Add, expr_2, expr_3);
- var expr_4 = global::System.Linq.Expressions.Expression.Bind(_p2, expr_1);
+ var expr_4 = global::System.Linq.Expressions.Expression.Bind(typeof(global::Foo.Child).GetProperty("Sum"), expr_1);
var expr_5 = global::System.Linq.Expressions.Expression.MemberInit(expr_0, expr_4);
return global::System.Linq.Expressions.Expression.Lambda>(expr_5, p_a, p_b);
}
diff --git a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_ReferencingPreviouslyAssignedProperty.verified.txt b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_ReferencingPreviouslyAssignedProperty.verified.txt
index 4afda40..0ffaaac 100644
--- a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_ReferencingPreviouslyAssignedProperty.verified.txt
+++ b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_ReferencingPreviouslyAssignedProperty.verified.txt
@@ -5,15 +5,8 @@ using Foo;
namespace ExpressiveSharp.Generated
{
- [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
- static class Foo_PersonDto__ctor_P0_string_P1_string
+ static partial class Foo_PersonDto
{
- private static readonly global::System.Reflection.ConstructorInfo _c0 = typeof(global::Foo.PersonDto).GetConstructor(new global::System.Type[] { });
- private static readonly global::System.Reflection.PropertyInfo _p0 = typeof(global::Foo.PersonDto).GetProperty("FirstName");
- private static readonly global::System.Reflection.MethodInfo _m0 = typeof(string).GetMethod("Concat", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(string), typeof(string) }, null);
- private static readonly global::System.Reflection.PropertyInfo _p1 = typeof(global::Foo.PersonDto).GetProperty("LastName");
- private static readonly global::System.Reflection.PropertyInfo _p2 = typeof(global::Foo.PersonDto).GetProperty("FullName");
-
// [Expressive]
// public PersonDto(string firstName, string lastName)
// {
@@ -21,20 +14,20 @@ namespace ExpressiveSharp.Generated
// LastName = lastName;
// FullName = FirstName + " " + LastName;
// }
- static global::System.Linq.Expressions.Expression> Expression()
+ static global::System.Linq.Expressions.Expression> _ctor_P0_string_P1_string_Expression()
{
var p_firstName = global::System.Linq.Expressions.Expression.Parameter(typeof(string), "firstName");
var p_lastName = global::System.Linq.Expressions.Expression.Parameter(typeof(string), "lastName");
- var expr_0 = global::System.Linq.Expressions.Expression.New(_c0);
+ var expr_0 = global::System.Linq.Expressions.Expression.New(typeof(global::Foo.PersonDto).GetConstructor(new global::System.Type[] { }));
var p___this = global::System.Linq.Expressions.Expression.Parameter(typeof(object), "@this"); // FirstName
- var expr_3 = global::System.Linq.Expressions.Expression.Property(p___this, _p0);
+ var expr_3 = global::System.Linq.Expressions.Expression.Property(p___this, typeof(global::Foo.PersonDto).GetProperty("FirstName"));
var expr_4 = global::System.Linq.Expressions.Expression.Constant(" ", typeof(string)); // " "
- var expr_2 = global::System.Linq.Expressions.Expression.Call(_m0, expr_3, expr_4);
- var expr_5 = global::System.Linq.Expressions.Expression.Property(p___this, _p1); // LastName
- var expr_1 = global::System.Linq.Expressions.Expression.Call(_m0, expr_2, expr_5);
- var expr_6 = global::System.Linq.Expressions.Expression.Bind(_p0, p_firstName);
- var expr_7 = global::System.Linq.Expressions.Expression.Bind(_p1, p_lastName);
- var expr_8 = global::System.Linq.Expressions.Expression.Bind(_p2, expr_1);
+ var expr_2 = global::System.Linq.Expressions.Expression.Call(typeof(string).GetMethod("Concat", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(string), typeof(string) }, null), expr_3, expr_4);
+ var expr_5 = global::System.Linq.Expressions.Expression.Property(p___this, typeof(global::Foo.PersonDto).GetProperty("LastName")); // LastName
+ var expr_1 = global::System.Linq.Expressions.Expression.Call(typeof(string).GetMethod("Concat", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(string), typeof(string) }, null), expr_2, expr_5);
+ var expr_6 = global::System.Linq.Expressions.Expression.Bind(typeof(global::Foo.PersonDto).GetProperty("FirstName"), p_firstName);
+ var expr_7 = global::System.Linq.Expressions.Expression.Bind(typeof(global::Foo.PersonDto).GetProperty("LastName"), p_lastName);
+ var expr_8 = global::System.Linq.Expressions.Expression.Bind(typeof(global::Foo.PersonDto).GetProperty("FullName"), expr_1);
var expr_9 = global::System.Linq.Expressions.Expression.MemberInit(expr_0, expr_6, expr_7, expr_8);
return global::System.Linq.Expressions.Expression.Lambda>(expr_9, p_firstName, p_lastName);
}
diff --git a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_ReferencingStaticConstMember.verified.txt b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_ReferencingStaticConstMember.verified.txt
index c05d228..16bc38d 100644
--- a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_ReferencingStaticConstMember.verified.txt
+++ b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_ReferencingStaticConstMember.verified.txt
@@ -5,28 +5,22 @@ using Foo;
namespace ExpressiveSharp.Generated
{
- [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
- static class Foo_PersonDto__ctor_P0_string_P1_string
+ static partial class Foo_PersonDto
{
- private static readonly global::System.Reflection.ConstructorInfo _c0 = typeof(global::Foo.PersonDto).GetConstructor(new global::System.Type[] { });
- private static readonly global::System.Reflection.FieldInfo _f0 = typeof(global::Foo.PersonDto).GetField("Separator", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static);
- private static readonly global::System.Reflection.MethodInfo _m0 = typeof(string).GetMethod("Concat", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(string), typeof(string) }, null);
- private static readonly global::System.Reflection.PropertyInfo _p0 = typeof(global::Foo.PersonDto).GetProperty("FullName");
-
// [Expressive]
// public PersonDto(string first, string last)
// {
// FullName = first + Separator + last;
// }
- static global::System.Linq.Expressions.Expression> Expression()
+ static global::System.Linq.Expressions.Expression> _ctor_P0_string_P1_string_Expression()
{
var p_first = global::System.Linq.Expressions.Expression.Parameter(typeof(string), "first");
var p_last = global::System.Linq.Expressions.Expression.Parameter(typeof(string), "last");
- var expr_0 = global::System.Linq.Expressions.Expression.New(_c0);
- var expr_3 = global::System.Linq.Expressions.Expression.Field(null, _f0); // Separator
- var expr_2 = global::System.Linq.Expressions.Expression.Call(_m0, p_first, expr_3);
- var expr_1 = global::System.Linq.Expressions.Expression.Call(_m0, expr_2, p_last);
- var expr_4 = global::System.Linq.Expressions.Expression.Bind(_p0, expr_1);
+ var expr_0 = global::System.Linq.Expressions.Expression.New(typeof(global::Foo.PersonDto).GetConstructor(new global::System.Type[] { }));
+ var expr_3 = global::System.Linq.Expressions.Expression.Field(null, typeof(global::Foo.PersonDto).GetField("Separator", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static)); // Separator
+ var expr_2 = global::System.Linq.Expressions.Expression.Call(typeof(string).GetMethod("Concat", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(string), typeof(string) }, null), p_first, expr_3);
+ var expr_1 = global::System.Linq.Expressions.Expression.Call(typeof(string).GetMethod("Concat", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(string), typeof(string) }, null), expr_2, p_last);
+ var expr_4 = global::System.Linq.Expressions.Expression.Bind(typeof(global::Foo.PersonDto).GetProperty("FullName"), expr_1);
var expr_5 = global::System.Linq.Expressions.Expression.MemberInit(expr_0, expr_4);
return global::System.Linq.Expressions.Expression.Lambda>(expr_5, p_first, p_last);
}
diff --git a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_ThisInitializer_ChainedThisAndBase.verified.txt b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_ThisInitializer_ChainedThisAndBase.verified.txt
index eec40be..2a0cc98 100644
--- a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_ThisInitializer_ChainedThisAndBase.verified.txt
+++ b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_ThisInitializer_ChainedThisAndBase.verified.txt
@@ -5,28 +5,23 @@ using Foo;
namespace ExpressiveSharp.Generated
{
- [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
- static class Foo_Child__ctor_P0_int_P1_string_P2_string
+ static partial class Foo_Child
{
- private static readonly global::System.Reflection.ConstructorInfo _c0 = typeof(global::Foo.Child).GetConstructor(new global::System.Type[] { });
- private static readonly global::System.Reflection.PropertyInfo _p0 = typeof(global::Foo.Child).GetProperty("Name");
- private static readonly global::System.Reflection.MethodInfo _m0 = typeof(string).GetMethod("Concat", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(string), typeof(string) }, null);
-
// [Expressive]
// public Child(int id, string name, string suffix) : this(id, name)
// {
// Name = Name + suffix;
// }
- static global::System.Linq.Expressions.Expression> Expression()
+ static global::System.Linq.Expressions.Expression> _ctor_P0_int_P1_string_P2_string_Expression()
{
var p_id = global::System.Linq.Expressions.Expression.Parameter(typeof(int), "id");
var p_name = global::System.Linq.Expressions.Expression.Parameter(typeof(string), "name");
var p_suffix = global::System.Linq.Expressions.Expression.Parameter(typeof(string), "suffix");
- var expr_0 = global::System.Linq.Expressions.Expression.New(_c0);
+ var expr_0 = global::System.Linq.Expressions.Expression.New(typeof(global::Foo.Child).GetConstructor(new global::System.Type[] { }));
var p___this = global::System.Linq.Expressions.Expression.Parameter(typeof(object), "@this"); // Name
- var expr_2 = global::System.Linq.Expressions.Expression.Property(p___this, _p0);
- var expr_1 = global::System.Linq.Expressions.Expression.Call(_m0, expr_2, p_suffix);
- var expr_3 = global::System.Linq.Expressions.Expression.Bind(_p0, expr_1);
+ var expr_2 = global::System.Linq.Expressions.Expression.Property(p___this, typeof(global::Foo.Child).GetProperty("Name"));
+ var expr_1 = global::System.Linq.Expressions.Expression.Call(typeof(string).GetMethod("Concat", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(string), typeof(string) }, null), expr_2, p_suffix);
+ var expr_3 = global::System.Linq.Expressions.Expression.Bind(typeof(global::Foo.Child).GetProperty("Name"), expr_1);
var expr_4 = global::System.Linq.Expressions.Expression.MemberInit(expr_0, expr_3);
return global::System.Linq.Expressions.Expression.Lambda>(expr_4, p_id, p_name, p_suffix);
}
diff --git a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_ThisInitializer_RefPreviouslyAssignedProperty.verified.txt b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_ThisInitializer_RefPreviouslyAssignedProperty.verified.txt
index 62a9dde..bcab035 100644
--- a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_ThisInitializer_RefPreviouslyAssignedProperty.verified.txt
+++ b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_ThisInitializer_RefPreviouslyAssignedProperty.verified.txt
@@ -5,19 +5,16 @@ using Foo;
namespace ExpressiveSharp.Generated
{
- [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
- static class Foo_PersonDto__ctor_P0_string
+ static partial class Foo_PersonDto
{
- private static readonly global::System.Reflection.ConstructorInfo _c0 = typeof(global::Foo.PersonDto).GetConstructor(new global::System.Type[] { });
-
// [Expressive]
// public PersonDto(string firstName) : this(firstName, "Doe")
// {
// }
- static global::System.Linq.Expressions.Expression> Expression()
+ static global::System.Linq.Expressions.Expression> _ctor_P0_string_Expression()
{
var p_firstName = global::System.Linq.Expressions.Expression.Parameter(typeof(string), "firstName");
- var expr_0 = global::System.Linq.Expressions.Expression.New(_c0);
+ var expr_0 = global::System.Linq.Expressions.Expression.New(typeof(global::Foo.PersonDto).GetConstructor(new global::System.Type[] { }));
return global::System.Linq.Expressions.Expression.Lambda>(expr_0, p_firstName);
}
}
diff --git a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_ThisInitializer_SimpleOverload.verified.txt b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_ThisInitializer_SimpleOverload.verified.txt
index e19090c..9923ca7 100644
--- a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_ThisInitializer_SimpleOverload.verified.txt
+++ b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_ThisInitializer_SimpleOverload.verified.txt
@@ -5,19 +5,16 @@ using Foo;
namespace ExpressiveSharp.Generated
{
- [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
- static class Foo_PersonDto__ctor_P0_string
+ static partial class Foo_PersonDto
{
- private static readonly global::System.Reflection.ConstructorInfo _c0 = typeof(global::Foo.PersonDto).GetConstructor(new global::System.Type[] { });
-
// [Expressive]
// public PersonDto(string fullName) : this(fullName.ToUpper(), fullName.ToLower())
// {
// }
- static global::System.Linq.Expressions.Expression> Expression()
+ static global::System.Linq.Expressions.Expression> _ctor_P0_string_Expression()
{
var p_fullName = global::System.Linq.Expressions.Expression.Parameter(typeof(string), "fullName");
- var expr_0 = global::System.Linq.Expressions.Expression.New(_c0);
+ var expr_0 = global::System.Linq.Expressions.Expression.New(typeof(global::Foo.PersonDto).GetConstructor(new global::System.Type[] { }));
return global::System.Linq.Expressions.Expression.Lambda>(expr_0, p_fullName);
}
}
diff --git a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_ThisInitializer_WithBodyAfter.verified.txt b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_ThisInitializer_WithBodyAfter.verified.txt
index 8ce8d5b..a30dfb7 100644
--- a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_ThisInitializer_WithBodyAfter.verified.txt
+++ b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_ThisInitializer_WithBodyAfter.verified.txt
@@ -5,41 +5,33 @@ using Foo;
namespace ExpressiveSharp.Generated
{
- [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
- static class Foo_PersonDto__ctor_P0_string_P1_string_P2_bool
+ static partial class Foo_PersonDto
{
- private static readonly global::System.Reflection.ConstructorInfo _c0 = typeof(global::Foo.PersonDto).GetConstructor(new global::System.Type[] { });
- private static readonly global::System.Reflection.MethodInfo _m0 = typeof(string).GetMethod("ToUpper", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { }, null);
- private static readonly global::System.Reflection.PropertyInfo _p0 = typeof(global::Foo.PersonDto).GetProperty("FirstName");
- private static readonly global::System.Reflection.MethodInfo _m1 = typeof(string).GetMethod("Concat", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(string), typeof(string) }, null);
- private static readonly global::System.Reflection.PropertyInfo _p1 = typeof(global::Foo.PersonDto).GetProperty("LastName");
- private static readonly global::System.Reflection.PropertyInfo _p2 = typeof(global::Foo.PersonDto).GetProperty("FullName");
-
// [Expressive]
// public PersonDto(string fn, string ln, bool upper) : this(fn, ln)
// {
// FullName = upper ? (FirstName + " " + LastName).ToUpper() : FirstName + " " + LastName;
// }
- static global::System.Linq.Expressions.Expression> Expression()
+ static global::System.Linq.Expressions.Expression> _ctor_P0_string_P1_string_P2_bool_Expression()
{
var p_fn = global::System.Linq.Expressions.Expression.Parameter(typeof(string), "fn");
var p_ln = global::System.Linq.Expressions.Expression.Parameter(typeof(string), "ln");
var p_upper = global::System.Linq.Expressions.Expression.Parameter(typeof(bool), "upper");
- var expr_0 = global::System.Linq.Expressions.Expression.New(_c0);
+ var expr_0 = global::System.Linq.Expressions.Expression.New(typeof(global::Foo.PersonDto).GetConstructor(new global::System.Type[] { }));
var p___this = global::System.Linq.Expressions.Expression.Parameter(typeof(object), "@this"); // FirstName
- var expr_5 = global::System.Linq.Expressions.Expression.Property(p___this, _p0);
+ var expr_5 = global::System.Linq.Expressions.Expression.Property(p___this, typeof(global::Foo.PersonDto).GetProperty("FirstName"));
var expr_6 = global::System.Linq.Expressions.Expression.Constant(" ", typeof(string)); // " "
- var expr_4 = global::System.Linq.Expressions.Expression.Call(_m1, expr_5, expr_6);
- var expr_7 = global::System.Linq.Expressions.Expression.Property(p___this, _p1); // LastName
- var expr_3 = global::System.Linq.Expressions.Expression.Call(_m1, expr_4, expr_7);
- var expr_2 = global::System.Linq.Expressions.Expression.Call(expr_3, _m0, global::System.Array.Empty());
- var expr_10 = global::System.Linq.Expressions.Expression.Property(p___this, _p0); // FirstName
+ var expr_4 = global::System.Linq.Expressions.Expression.Call(typeof(string).GetMethod("Concat", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(string), typeof(string) }, null), expr_5, expr_6);
+ var expr_7 = global::System.Linq.Expressions.Expression.Property(p___this, typeof(global::Foo.PersonDto).GetProperty("LastName")); // LastName
+ var expr_3 = global::System.Linq.Expressions.Expression.Call(typeof(string).GetMethod("Concat", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(string), typeof(string) }, null), expr_4, expr_7);
+ var expr_2 = global::System.Linq.Expressions.Expression.Call(expr_3, typeof(string).GetMethod("ToUpper", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { }, null), global::System.Array.Empty());
+ var expr_10 = global::System.Linq.Expressions.Expression.Property(p___this, typeof(global::Foo.PersonDto).GetProperty("FirstName")); // FirstName
var expr_11 = global::System.Linq.Expressions.Expression.Constant(" ", typeof(string)); // " "
- var expr_9 = global::System.Linq.Expressions.Expression.Call(_m1, expr_10, expr_11);
- var expr_12 = global::System.Linq.Expressions.Expression.Property(p___this, _p1); // LastName
- var expr_8 = global::System.Linq.Expressions.Expression.Call(_m1, expr_9, expr_12);
+ var expr_9 = global::System.Linq.Expressions.Expression.Call(typeof(string).GetMethod("Concat", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(string), typeof(string) }, null), expr_10, expr_11);
+ var expr_12 = global::System.Linq.Expressions.Expression.Property(p___this, typeof(global::Foo.PersonDto).GetProperty("LastName")); // LastName
+ var expr_8 = global::System.Linq.Expressions.Expression.Call(typeof(string).GetMethod("Concat", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(string), typeof(string) }, null), expr_9, expr_12);
var expr_1 = global::System.Linq.Expressions.Expression.Condition(p_upper, expr_2, expr_8, typeof(string));
- var expr_13 = global::System.Linq.Expressions.Expression.Bind(_p2, expr_1);
+ var expr_13 = global::System.Linq.Expressions.Expression.Bind(typeof(global::Foo.PersonDto).GetProperty("FullName"), expr_1);
var expr_14 = global::System.Linq.Expressions.Expression.MemberInit(expr_0, expr_13);
return global::System.Linq.Expressions.Expression.Lambda>(expr_14, p_fn, p_ln, p_upper);
}
diff --git a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_ThisInitializer_WithIfElseInDelegated.verified.txt b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_ThisInitializer_WithIfElseInDelegated.verified.txt
index b7a3f7a..230cb2a 100644
--- a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_ThisInitializer_WithIfElseInDelegated.verified.txt
+++ b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_ThisInitializer_WithIfElseInDelegated.verified.txt
@@ -5,27 +5,22 @@ using Foo;
namespace ExpressiveSharp.Generated
{
- [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
- static class Foo_PersonDto__ctor_P0_int_P1_string
+ static partial class Foo_PersonDto
{
- private static readonly global::System.Reflection.ConstructorInfo _c0 = typeof(global::Foo.PersonDto).GetConstructor(new global::System.Type[] { });
- private static readonly global::System.Reflection.PropertyInfo _p0 = typeof(global::Foo.PersonDto).GetProperty("Label");
- private static readonly global::System.Reflection.MethodInfo _m0 = typeof(string).GetMethod("Concat", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(string), typeof(string) }, null);
-
// [Expressive]
// public PersonDto(int score, string prefix) : this(score)
// {
// Label = prefix + Label;
// }
- static global::System.Linq.Expressions.Expression> Expression()
+ static global::System.Linq.Expressions.Expression> _ctor_P0_int_P1_string_Expression()
{
var p_score = global::System.Linq.Expressions.Expression.Parameter(typeof(int), "score");
var p_prefix = global::System.Linq.Expressions.Expression.Parameter(typeof(string), "prefix");
- var expr_0 = global::System.Linq.Expressions.Expression.New(_c0);
+ var expr_0 = global::System.Linq.Expressions.Expression.New(typeof(global::Foo.PersonDto).GetConstructor(new global::System.Type[] { }));
var p___this = global::System.Linq.Expressions.Expression.Parameter(typeof(object), "@this"); // Label
- var expr_2 = global::System.Linq.Expressions.Expression.Property(p___this, _p0);
- var expr_1 = global::System.Linq.Expressions.Expression.Call(_m0, p_prefix, expr_2);
- var expr_3 = global::System.Linq.Expressions.Expression.Bind(_p0, expr_1);
+ var expr_2 = global::System.Linq.Expressions.Expression.Property(p___this, typeof(global::Foo.PersonDto).GetProperty("Label"));
+ var expr_1 = global::System.Linq.Expressions.Expression.Call(typeof(string).GetMethod("Concat", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(string), typeof(string) }, null), p_prefix, expr_2);
+ var expr_3 = global::System.Linq.Expressions.Expression.Bind(typeof(global::Foo.PersonDto).GetProperty("Label"), expr_1);
var expr_4 = global::System.Linq.Expressions.Expression.MemberInit(expr_0, expr_3);
return global::System.Linq.Expressions.Expression.Lambda>(expr_4, p_score, p_prefix);
}
diff --git a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithBaseInitializer.verified.txt b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithBaseInitializer.verified.txt
index c5e7d63..2b0571f 100644
--- a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithBaseInitializer.verified.txt
+++ b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithBaseInitializer.verified.txt
@@ -5,23 +5,19 @@ using Foo;
namespace ExpressiveSharp.Generated
{
- [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
- static class Foo_Child__ctor_P0_int_P1_string
+ static partial class Foo_Child
{
- private static readonly global::System.Reflection.ConstructorInfo _c0 = typeof(global::Foo.Child).GetConstructor(new global::System.Type[] { });
- private static readonly global::System.Reflection.PropertyInfo _p0 = typeof(global::Foo.Child).GetProperty("Name");
-
// [Expressive]
// public Child(int id, string name) : base(id)
// {
// Name = name;
// }
- static global::System.Linq.Expressions.Expression> Expression()
+ static global::System.Linq.Expressions.Expression> _ctor_P0_int_P1_string_Expression()
{
var p_id = global::System.Linq.Expressions.Expression.Parameter(typeof(int), "id");
var p_name = global::System.Linq.Expressions.Expression.Parameter(typeof(string), "name");
- var expr_0 = global::System.Linq.Expressions.Expression.New(_c0);
- var expr_1 = global::System.Linq.Expressions.Expression.Bind(_p0, p_name);
+ var expr_0 = global::System.Linq.Expressions.Expression.New(typeof(global::Foo.Child).GetConstructor(new global::System.Type[] { }));
+ var expr_1 = global::System.Linq.Expressions.Expression.Bind(typeof(global::Foo.Child).GetProperty("Name"), p_name);
var expr_2 = global::System.Linq.Expressions.Expression.MemberInit(expr_0, expr_1);
return global::System.Linq.Expressions.Expression.Lambda>(expr_2, p_id, p_name);
}
diff --git a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithBaseInitializerAndIfElse.verified.txt b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithBaseInitializerAndIfElse.verified.txt
index c5e7d63..2b0571f 100644
--- a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithBaseInitializerAndIfElse.verified.txt
+++ b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithBaseInitializerAndIfElse.verified.txt
@@ -5,23 +5,19 @@ using Foo;
namespace ExpressiveSharp.Generated
{
- [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
- static class Foo_Child__ctor_P0_int_P1_string
+ static partial class Foo_Child
{
- private static readonly global::System.Reflection.ConstructorInfo _c0 = typeof(global::Foo.Child).GetConstructor(new global::System.Type[] { });
- private static readonly global::System.Reflection.PropertyInfo _p0 = typeof(global::Foo.Child).GetProperty("Name");
-
// [Expressive]
// public Child(int id, string name) : base(id)
// {
// Name = name;
// }
- static global::System.Linq.Expressions.Expression> Expression()
+ static global::System.Linq.Expressions.Expression> _ctor_P0_int_P1_string_Expression()
{
var p_id = global::System.Linq.Expressions.Expression.Parameter(typeof(int), "id");
var p_name = global::System.Linq.Expressions.Expression.Parameter(typeof(string), "name");
- var expr_0 = global::System.Linq.Expressions.Expression.New(_c0);
- var expr_1 = global::System.Linq.Expressions.Expression.Bind(_p0, p_name);
+ var expr_0 = global::System.Linq.Expressions.Expression.New(typeof(global::Foo.Child).GetConstructor(new global::System.Type[] { }));
+ var expr_1 = global::System.Linq.Expressions.Expression.Bind(typeof(global::Foo.Child).GetProperty("Name"), p_name);
var expr_2 = global::System.Linq.Expressions.Expression.MemberInit(expr_0, expr_1);
return global::System.Linq.Expressions.Expression.Lambda>(expr_2, p_id, p_name);
}
diff --git a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithBaseInitializerExpression.verified.txt b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithBaseInitializerExpression.verified.txt
index 7039c04..ea38b19 100644
--- a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithBaseInitializerExpression.verified.txt
+++ b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithBaseInitializerExpression.verified.txt
@@ -5,23 +5,19 @@ using Foo;
namespace ExpressiveSharp.Generated
{
- [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
- static class Foo_Child__ctor_P0_string_P1_string
+ static partial class Foo_Child
{
- private static readonly global::System.Reflection.ConstructorInfo _c0 = typeof(global::Foo.Child).GetConstructor(new global::System.Type[] { });
- private static readonly global::System.Reflection.PropertyInfo _p0 = typeof(global::Foo.Child).GetProperty("Name");
-
// [Expressive]
// public Child(string name, string rawCode) : base(rawCode.ToUpper())
// {
// Name = name;
// }
- static global::System.Linq.Expressions.Expression> Expression()
+ static global::System.Linq.Expressions.Expression> _ctor_P0_string_P1_string_Expression()
{
var p_name = global::System.Linq.Expressions.Expression.Parameter(typeof(string), "name");
var p_rawCode = global::System.Linq.Expressions.Expression.Parameter(typeof(string), "rawCode");
- var expr_0 = global::System.Linq.Expressions.Expression.New(_c0);
- var expr_1 = global::System.Linq.Expressions.Expression.Bind(_p0, p_name);
+ var expr_0 = global::System.Linq.Expressions.Expression.New(typeof(global::Foo.Child).GetConstructor(new global::System.Type[] { }));
+ var expr_1 = global::System.Linq.Expressions.Expression.Bind(typeof(global::Foo.Child).GetProperty("Name"), p_name);
var expr_2 = global::System.Linq.Expressions.Expression.MemberInit(expr_0, expr_1);
return global::System.Linq.Expressions.Expression.Lambda>(expr_2, p_name, p_rawCode);
}
diff --git a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithBaseInitializer_AndEarlyReturn.verified.txt b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithBaseInitializer_AndEarlyReturn.verified.txt
index 0ef306a..e5a0fa2 100644
--- a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithBaseInitializer_AndEarlyReturn.verified.txt
+++ b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithBaseInitializer_AndEarlyReturn.verified.txt
@@ -5,13 +5,8 @@ using Foo;
namespace ExpressiveSharp.Generated
{
- [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
- static class Foo_Car__ctor_P0_string_P1_int
+ static partial class Foo_Car
{
- private static readonly global::System.Reflection.ConstructorInfo _c0 = typeof(global::Foo.Car).GetConstructor(new global::System.Type[] { });
- private static readonly global::System.Reflection.PropertyInfo _p0 = typeof(global::Foo.Car).GetProperty("Model");
- private static readonly global::System.Reflection.PropertyInfo _p1 = typeof(global::Foo.Car).GetProperty("Year");
-
// [Expressive]
// public Car(string model, int year) : base("Car")
// {
@@ -24,18 +19,18 @@ namespace ExpressiveSharp.Generated
//
// Year = year;
// }
- static global::System.Linq.Expressions.Expression> Expression()
+ static global::System.Linq.Expressions.Expression> _ctor_P0_string_P1_int_Expression()
{
var p_model = global::System.Linq.Expressions.Expression.Parameter(typeof(string), "model");
var p_year = global::System.Linq.Expressions.Expression.Parameter(typeof(int), "year");
- var expr_0 = global::System.Linq.Expressions.Expression.New(_c0);
+ var expr_0 = global::System.Linq.Expressions.Expression.New(typeof(global::Foo.Car).GetConstructor(new global::System.Type[] { }));
var expr_1 = global::System.Linq.Expressions.Expression.Constant(2000, typeof(int)); // 2000
var expr_3 = global::System.Linq.Expressions.Expression.Constant(0, typeof(int)); // 0
var expr_2 = global::System.Linq.Expressions.Expression.MakeBinary(global::System.Linq.Expressions.ExpressionType.LessThanOrEqual, p_year, expr_3);
var expr_4 = global::System.Linq.Expressions.Expression.Default(typeof(int));
var expr_5 = global::System.Linq.Expressions.Expression.Condition(expr_2, expr_1, expr_4, typeof(int));
- var expr_6 = global::System.Linq.Expressions.Expression.Bind(_p0, p_model);
- var expr_7 = global::System.Linq.Expressions.Expression.Bind(_p1, p_year);
+ var expr_6 = global::System.Linq.Expressions.Expression.Bind(typeof(global::Foo.Car).GetProperty("Model"), p_model);
+ var expr_7 = global::System.Linq.Expressions.Expression.Bind(typeof(global::Foo.Car).GetProperty("Year"), p_year);
var expr_8 = global::System.Linq.Expressions.Expression.MemberInit(expr_0, expr_6, expr_7);
return global::System.Linq.Expressions.Expression.Lambda>(expr_8, p_model, p_year);
}
diff --git a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithBaseInitializer_AndIfElse_InDerivedBody.verified.txt b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithBaseInitializer_AndIfElse_InDerivedBody.verified.txt
index 8031df3..a5d6f31 100644
--- a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithBaseInitializer_AndIfElse_InDerivedBody.verified.txt
+++ b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithBaseInitializer_AndIfElse_InDerivedBody.verified.txt
@@ -5,15 +5,8 @@ using Foo;
namespace ExpressiveSharp.Generated
{
- [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
- static class Foo_Pet__ctor_P0_string_P1_string_P2_bool
+ static partial class Foo_Pet
{
- private static readonly global::System.Reflection.ConstructorInfo _c0 = typeof(global::Foo.Pet).GetConstructor(new global::System.Type[] { });
- private static readonly global::System.Reflection.PropertyInfo _p0 = typeof(string).GetProperty("Length");
- private static readonly global::System.Reflection.MethodInfo _m0 = typeof(string).GetMethod("Substring", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(int) }, null);
- private static readonly global::System.Reflection.PropertyInfo _p1 = typeof(global::Foo.Pet).GetProperty("Name");
- private static readonly global::System.Reflection.PropertyInfo _p2 = typeof(global::Foo.Pet).GetProperty("Nickname");
-
// [Expressive]
// public Pet(string species, string name, bool useShortName) : base(species)
// {
@@ -27,22 +20,22 @@ namespace ExpressiveSharp.Generated
// Nickname = name;
// }
// }
- static global::System.Linq.Expressions.Expression> Expression()
+ static global::System.Linq.Expressions.Expression> _ctor_P0_string_P1_string_P2_bool_Expression()
{
var p_species = global::System.Linq.Expressions.Expression.Parameter(typeof(string), "species");
var p_name = global::System.Linq.Expressions.Expression.Parameter(typeof(string), "name");
var p_useShortName = global::System.Linq.Expressions.Expression.Parameter(typeof(bool), "useShortName");
- var expr_0 = global::System.Linq.Expressions.Expression.New(_c0);
- var expr_3 = global::System.Linq.Expressions.Expression.Property(p_name, _p0); // name.Length
+ var expr_0 = global::System.Linq.Expressions.Expression.New(typeof(global::Foo.Pet).GetConstructor(new global::System.Type[] { }));
+ var expr_3 = global::System.Linq.Expressions.Expression.Property(p_name, typeof(string).GetProperty("Length")); // name.Length
var expr_4 = global::System.Linq.Expressions.Expression.Constant(3, typeof(int)); // 3
var expr_2 = global::System.Linq.Expressions.Expression.MakeBinary(global::System.Linq.Expressions.ExpressionType.GreaterThan, expr_3, expr_4);
var expr_6 = global::System.Linq.Expressions.Expression.Constant(0, typeof(int)); // 0
var expr_7 = global::System.Linq.Expressions.Expression.Constant(3, typeof(int)); // 3
- var expr_5 = global::System.Linq.Expressions.Expression.Call(p_name, _m0, new global::System.Linq.Expressions.Expression[] { expr_6, expr_7 });
+ var expr_5 = global::System.Linq.Expressions.Expression.Call(p_name, typeof(string).GetMethod("Substring", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(int) }, null), new global::System.Linq.Expressions.Expression[] { expr_6, expr_7 });
var expr_1 = global::System.Linq.Expressions.Expression.Condition(expr_2, expr_5, p_name, typeof(string));
var expr_8 = global::System.Linq.Expressions.Expression.Condition(p_useShortName, expr_1, p_name, typeof(string));
- var expr_9 = global::System.Linq.Expressions.Expression.Bind(_p1, p_name);
- var expr_10 = global::System.Linq.Expressions.Expression.Bind(_p2, expr_8);
+ var expr_9 = global::System.Linq.Expressions.Expression.Bind(typeof(global::Foo.Pet).GetProperty("Name"), p_name);
+ var expr_10 = global::System.Linq.Expressions.Expression.Bind(typeof(global::Foo.Pet).GetProperty("Nickname"), expr_8);
var expr_11 = global::System.Linq.Expressions.Expression.MemberInit(expr_0, expr_9, expr_10);
return global::System.Linq.Expressions.Expression.Lambda>(expr_11, p_species, p_name, p_useShortName);
}
diff --git a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithClassArgument.verified.txt b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithClassArgument.verified.txt
index 09853be..9b0c62b 100644
--- a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithClassArgument.verified.txt
+++ b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithClassArgument.verified.txt
@@ -5,29 +5,22 @@ using Foo;
namespace ExpressiveSharp.Generated
{
- [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
- static class Foo_PersonDto__ctor_P0_Foo_SourceEntity
+ static partial class Foo_PersonDto
{
- private static readonly global::System.Reflection.ConstructorInfo _c0 = typeof(global::Foo.PersonDto).GetConstructor(new global::System.Type[] { });
- private static readonly global::System.Reflection.PropertyInfo _p0 = typeof(global::Foo.SourceEntity).GetProperty("Id");
- private static readonly global::System.Reflection.PropertyInfo _p1 = typeof(global::Foo.SourceEntity).GetProperty("Name");
- private static readonly global::System.Reflection.PropertyInfo _p2 = typeof(global::Foo.PersonDto).GetProperty("Id");
- private static readonly global::System.Reflection.PropertyInfo _p3 = typeof(global::Foo.PersonDto).GetProperty("Name");
-
// [Expressive]
// public PersonDto(SourceEntity source)
// {
// Id = source.Id;
// Name = source.Name;
// }
- static global::System.Linq.Expressions.Expression> Expression()
+ static global::System.Linq.Expressions.Expression> _ctor_P0_Foo_SourceEntity_Expression()
{
var p_source = global::System.Linq.Expressions.Expression.Parameter(typeof(global::Foo.SourceEntity), "source");
- var expr_0 = global::System.Linq.Expressions.Expression.New(_c0);
- var expr_1 = global::System.Linq.Expressions.Expression.Property(p_source, _p0); // source.Id
- var expr_2 = global::System.Linq.Expressions.Expression.Property(p_source, _p1); // source.Name
- var expr_3 = global::System.Linq.Expressions.Expression.Bind(_p2, expr_1);
- var expr_4 = global::System.Linq.Expressions.Expression.Bind(_p3, expr_2);
+ var expr_0 = global::System.Linq.Expressions.Expression.New(typeof(global::Foo.PersonDto).GetConstructor(new global::System.Type[] { }));
+ var expr_1 = global::System.Linq.Expressions.Expression.Property(p_source, typeof(global::Foo.SourceEntity).GetProperty("Id")); // source.Id
+ var expr_2 = global::System.Linq.Expressions.Expression.Property(p_source, typeof(global::Foo.SourceEntity).GetProperty("Name")); // source.Name
+ var expr_3 = global::System.Linq.Expressions.Expression.Bind(typeof(global::Foo.PersonDto).GetProperty("Id"), expr_1);
+ var expr_4 = global::System.Linq.Expressions.Expression.Bind(typeof(global::Foo.PersonDto).GetProperty("Name"), expr_2);
var expr_5 = global::System.Linq.Expressions.Expression.MemberInit(expr_0, expr_3, expr_4);
return global::System.Linq.Expressions.Expression.Lambda>(expr_5, p_source);
}
diff --git a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithDeepNestedIf.verified.txt b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithDeepNestedIf.verified.txt
index 1f6285f..d89b695 100644
--- a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithDeepNestedIf.verified.txt
+++ b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithDeepNestedIf.verified.txt
@@ -5,12 +5,8 @@ using Foo;
namespace ExpressiveSharp.Generated
{
- [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
- static class Foo_AccessDto__ctor_P0_bool_P1_bool_P2_bool
+ static partial class Foo_AccessDto
{
- private static readonly global::System.Reflection.ConstructorInfo _c0 = typeof(global::Foo.AccessDto).GetConstructor(new global::System.Type[] { });
- private static readonly global::System.Reflection.PropertyInfo _p0 = typeof(global::Foo.AccessDto).GetProperty("Access");
-
// [Expressive]
// public AccessDto(bool isLoggedIn, bool isVerified, bool isAdmin)
// {
@@ -37,12 +33,12 @@ namespace ExpressiveSharp.Generated
// Access = "Guest";
// }
// }
- static global::System.Linq.Expressions.Expression> Expression()
+ static global::System.Linq.Expressions.Expression> _ctor_P0_bool_P1_bool_P2_bool_Expression()
{
var p_isLoggedIn = global::System.Linq.Expressions.Expression.Parameter(typeof(bool), "isLoggedIn");
var p_isVerified = global::System.Linq.Expressions.Expression.Parameter(typeof(bool), "isVerified");
var p_isAdmin = global::System.Linq.Expressions.Expression.Parameter(typeof(bool), "isAdmin");
- var expr_0 = global::System.Linq.Expressions.Expression.New(_c0);
+ var expr_0 = global::System.Linq.Expressions.Expression.New(typeof(global::Foo.AccessDto).GetConstructor(new global::System.Type[] { }));
var expr_1 = global::System.Linq.Expressions.Expression.Constant("Full", typeof(string)); // "Full"
var expr_2 = global::System.Linq.Expressions.Expression.Constant("Verified", typeof(string)); // "Verified"
var expr_3 = global::System.Linq.Expressions.Expression.Condition(p_isAdmin, expr_1, expr_2, typeof(string));
@@ -50,7 +46,7 @@ namespace ExpressiveSharp.Generated
var expr_5 = global::System.Linq.Expressions.Expression.Condition(p_isVerified, expr_3, expr_4, typeof(string));
var expr_6 = global::System.Linq.Expressions.Expression.Constant("Guest", typeof(string)); // "Guest"
var expr_7 = global::System.Linq.Expressions.Expression.Condition(p_isLoggedIn, expr_5, expr_6, typeof(string));
- var expr_8 = global::System.Linq.Expressions.Expression.Bind(_p0, expr_7);
+ var expr_8 = global::System.Linq.Expressions.Expression.Bind(typeof(global::Foo.AccessDto).GetProperty("Access"), expr_7);
var expr_9 = global::System.Linq.Expressions.Expression.MemberInit(expr_0, expr_8);
return global::System.Linq.Expressions.Expression.Lambda>(expr_9, p_isLoggedIn, p_isVerified, p_isAdmin);
}
diff --git a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithEarlyReturn_GuardClause.verified.txt b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithEarlyReturn_GuardClause.verified.txt
index 5154772..ed472c2 100644
--- a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithEarlyReturn_GuardClause.verified.txt
+++ b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithEarlyReturn_GuardClause.verified.txt
@@ -5,14 +5,8 @@ using Foo;
namespace ExpressiveSharp.Generated
{
- [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
- static class Foo_ItemDto__ctor_P0_string_P1_string
+ static partial class Foo_ItemDto
{
- private static readonly global::System.Reflection.ConstructorInfo _c0 = typeof(global::Foo.ItemDto).GetConstructor(new global::System.Type[] { });
- private static readonly global::System.Reflection.MethodInfo _m0 = typeof(string).GetMethod("IsNullOrEmpty", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(string) }, null);
- private static readonly global::System.Reflection.PropertyInfo _p0 = typeof(global::Foo.ItemDto).GetProperty("Name");
- private static readonly global::System.Reflection.PropertyInfo _p1 = typeof(global::Foo.ItemDto).GetProperty("Category");
-
// [Expressive]
// public ItemDto(string name, string category)
// {
@@ -25,17 +19,17 @@ namespace ExpressiveSharp.Generated
//
// Category = category;
// }
- static global::System.Linq.Expressions.Expression> Expression()
+ static global::System.Linq.Expressions.Expression> _ctor_P0_string_P1_string_Expression()
{
var p_name = global::System.Linq.Expressions.Expression.Parameter(typeof(string), "name");
var p_category = global::System.Linq.Expressions.Expression.Parameter(typeof(string), "category");
- var expr_0 = global::System.Linq.Expressions.Expression.New(_c0);
+ var expr_0 = global::System.Linq.Expressions.Expression.New(typeof(global::Foo.ItemDto).GetConstructor(new global::System.Type[] { }));
var expr_1 = global::System.Linq.Expressions.Expression.Constant("Unknown", typeof(string)); // "Unknown"
- var expr_2 = global::System.Linq.Expressions.Expression.Call(_m0, new global::System.Linq.Expressions.Expression[] { p_category }); // string.IsNullOrEmpty(category)
+ var expr_2 = global::System.Linq.Expressions.Expression.Call(typeof(string).GetMethod("IsNullOrEmpty", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(string) }, null), new global::System.Linq.Expressions.Expression[] { p_category }); // string.IsNullOrEmpty(category)
var expr_3 = global::System.Linq.Expressions.Expression.Default(typeof(string));
var expr_4 = global::System.Linq.Expressions.Expression.Condition(expr_2, expr_1, expr_3, typeof(string));
- var expr_5 = global::System.Linq.Expressions.Expression.Bind(_p0, p_name);
- var expr_6 = global::System.Linq.Expressions.Expression.Bind(_p1, p_category);
+ var expr_5 = global::System.Linq.Expressions.Expression.Bind(typeof(global::Foo.ItemDto).GetProperty("Name"), p_name);
+ var expr_6 = global::System.Linq.Expressions.Expression.Bind(typeof(global::Foo.ItemDto).GetProperty("Category"), p_category);
var expr_7 = global::System.Linq.Expressions.Expression.MemberInit(expr_0, expr_5, expr_6);
return global::System.Linq.Expressions.Expression.Lambda>(expr_7, p_name, p_category);
}
diff --git a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithElseIfChain.verified.txt b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithElseIfChain.verified.txt
index 2719d5e..ed7c0b8 100644
--- a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithElseIfChain.verified.txt
+++ b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithElseIfChain.verified.txt
@@ -5,12 +5,8 @@ using Foo;
namespace ExpressiveSharp.Generated
{
- [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
- static class Foo_GradeDto__ctor_P0_int
+ static partial class Foo_GradeDto
{
- private static readonly global::System.Reflection.ConstructorInfo _c0 = typeof(global::Foo.GradeDto).GetConstructor(new global::System.Type[] { });
- private static readonly global::System.Reflection.PropertyInfo _p0 = typeof(global::Foo.GradeDto).GetProperty("Grade");
-
// [Expressive]
// public GradeDto(int score)
// {
@@ -31,10 +27,10 @@ namespace ExpressiveSharp.Generated
// Grade = "F";
// }
// }
- static global::System.Linq.Expressions.Expression> Expression()
+ static global::System.Linq.Expressions.Expression> _ctor_P0_int_Expression()
{
var p_score = global::System.Linq.Expressions.Expression.Parameter(typeof(int), "score");
- var expr_0 = global::System.Linq.Expressions.Expression.New(_c0);
+ var expr_0 = global::System.Linq.Expressions.Expression.New(typeof(global::Foo.GradeDto).GetConstructor(new global::System.Type[] { }));
var expr_1 = global::System.Linq.Expressions.Expression.Constant("A", typeof(string)); // "A"
var expr_2 = global::System.Linq.Expressions.Expression.Constant("B", typeof(string)); // "B"
var expr_3 = global::System.Linq.Expressions.Expression.Constant("C", typeof(string)); // "C"
@@ -48,7 +44,7 @@ namespace ExpressiveSharp.Generated
var expr_12 = global::System.Linq.Expressions.Expression.Constant(90, typeof(int)); // 90
var expr_11 = global::System.Linq.Expressions.Expression.MakeBinary(global::System.Linq.Expressions.ExpressionType.GreaterThanOrEqual, p_score, expr_12);
var expr_13 = global::System.Linq.Expressions.Expression.Condition(expr_11, expr_1, expr_10, typeof(string));
- var expr_14 = global::System.Linq.Expressions.Expression.Bind(_p0, expr_13);
+ var expr_14 = global::System.Linq.Expressions.Expression.Bind(typeof(global::Foo.GradeDto).GetProperty("Grade"), expr_13);
var expr_15 = global::System.Linq.Expressions.Expression.MemberInit(expr_0, expr_14);
return global::System.Linq.Expressions.Expression.Lambda>(expr_15, p_score);
}
diff --git a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithExplicitParameterlessConstructor_Succeeds.verified.txt b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithExplicitParameterlessConstructor_Succeeds.verified.txt
index 7fdbf70..f3e1b36 100644
--- a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithExplicitParameterlessConstructor_Succeeds.verified.txt
+++ b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithExplicitParameterlessConstructor_Succeeds.verified.txt
@@ -5,22 +5,18 @@ using Foo;
namespace ExpressiveSharp.Generated
{
- [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
- static class Foo_PersonDto__ctor_P0_string
+ static partial class Foo_PersonDto
{
- private static readonly global::System.Reflection.ConstructorInfo _c0 = typeof(global::Foo.PersonDto).GetConstructor(new global::System.Type[] { });
- private static readonly global::System.Reflection.PropertyInfo _p0 = typeof(global::Foo.PersonDto).GetProperty("Name");
-
// [Expressive]
// public PersonDto(string name)
// {
// Name = name;
// }
- static global::System.Linq.Expressions.Expression> Expression()
+ static global::System.Linq.Expressions.Expression> _ctor_P0_string_Expression()
{
var p_name = global::System.Linq.Expressions.Expression.Parameter(typeof(string), "name");
- var expr_0 = global::System.Linq.Expressions.Expression.New(_c0);
- var expr_1 = global::System.Linq.Expressions.Expression.Bind(_p0, p_name);
+ var expr_0 = global::System.Linq.Expressions.Expression.New(typeof(global::Foo.PersonDto).GetConstructor(new global::System.Type[] { }));
+ var expr_1 = global::System.Linq.Expressions.Expression.Bind(typeof(global::Foo.PersonDto).GetProperty("Name"), p_name);
var expr_2 = global::System.Linq.Expressions.Expression.MemberInit(expr_0, expr_1);
return global::System.Linq.Expressions.Expression.Lambda>(expr_2, p_name);
}
diff --git a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithFullObject.verified.txt b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithFullObject.verified.txt
index b6149fb..908f85c 100644
--- a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithFullObject.verified.txt
+++ b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithFullObject.verified.txt
@@ -5,22 +5,8 @@ using Foo;
namespace ExpressiveSharp.Generated
{
- [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
- static class Foo_CustomerDto__ctor_P0_Foo_Customer
+ static partial class Foo_CustomerDto
{
- private static readonly global::System.Reflection.ConstructorInfo _c0 = typeof(global::Foo.CustomerDto).GetConstructor(new global::System.Type[] { });
- private static readonly global::System.Reflection.PropertyInfo _p0 = typeof(global::Foo.Customer).GetProperty("Id");
- private static readonly global::System.Reflection.PropertyInfo _p1 = typeof(global::Foo.Customer).GetProperty("FirstName");
- private static readonly global::System.Reflection.MethodInfo _m0 = typeof(string).GetMethod("Concat", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(string), typeof(string) }, null);
- private static readonly global::System.Reflection.PropertyInfo _p2 = typeof(global::Foo.Customer).GetProperty("LastName");
- private static readonly global::System.Reflection.PropertyInfo _p3 = typeof(global::Foo.Customer).GetProperty("IsActive");
- private static readonly global::System.Reflection.MethodInfo _m1 = global::System.Linq.Enumerable.First(global::System.Linq.Enumerable.Where(typeof(global::System.Linq.Enumerable).GetMethods(global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static), m => m.Name == "Count" && m.IsGenericMethodDefinition && m.GetGenericArguments().Length == 1 && m.GetParameters().Length == 1)).MakeGenericMethod(typeof(global::Foo.Order));
- private static readonly global::System.Reflection.PropertyInfo _p4 = typeof(global::Foo.Customer).GetProperty("Orders");
- private static readonly global::System.Reflection.PropertyInfo _p5 = typeof(global::Foo.CustomerDto).GetProperty("Id");
- private static readonly global::System.Reflection.PropertyInfo _p6 = typeof(global::Foo.CustomerDto).GetProperty("FullName");
- private static readonly global::System.Reflection.PropertyInfo _p7 = typeof(global::Foo.CustomerDto).GetProperty("IsActive");
- private static readonly global::System.Reflection.PropertyInfo _p8 = typeof(global::Foo.CustomerDto).GetProperty("OrderCount");
-
// [Expressive]
// public CustomerDto(Customer customer)
// {
@@ -29,24 +15,24 @@ namespace ExpressiveSharp.Generated
// IsActive = customer.IsActive;
// OrderCount = customer.Orders.Count();
// }
- static global::System.Linq.Expressions.Expression> Expression()
+ static global::System.Linq.Expressions.Expression> _ctor_P0_Foo_Customer_Expression()
{
var p_customer = global::System.Linq.Expressions.Expression.Parameter(typeof(global::Foo.Customer), "customer");
- var expr_0 = global::System.Linq.Expressions.Expression.New(_c0);
- var expr_1 = global::System.Linq.Expressions.Expression.Property(p_customer, _p0); // customer.Id
- var expr_4 = global::System.Linq.Expressions.Expression.Property(p_customer, _p1); // customer.FirstName
+ var expr_0 = global::System.Linq.Expressions.Expression.New(typeof(global::Foo.CustomerDto).GetConstructor(new global::System.Type[] { }));
+ var expr_1 = global::System.Linq.Expressions.Expression.Property(p_customer, typeof(global::Foo.Customer).GetProperty("Id")); // customer.Id
+ var expr_4 = global::System.Linq.Expressions.Expression.Property(p_customer, typeof(global::Foo.Customer).GetProperty("FirstName")); // customer.FirstName
var expr_5 = global::System.Linq.Expressions.Expression.Constant(" ", typeof(string)); // " "
- var expr_3 = global::System.Linq.Expressions.Expression.Call(_m0, expr_4, expr_5);
- var expr_6 = global::System.Linq.Expressions.Expression.Property(p_customer, _p2); // customer.LastName
- var expr_2 = global::System.Linq.Expressions.Expression.Call(_m0, expr_3, expr_6);
- var expr_7 = global::System.Linq.Expressions.Expression.Property(p_customer, _p3); // customer.IsActive
- var expr_10 = global::System.Linq.Expressions.Expression.Property(p_customer, _p4); // customer.Orders
+ var expr_3 = global::System.Linq.Expressions.Expression.Call(typeof(string).GetMethod("Concat", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(string), typeof(string) }, null), expr_4, expr_5);
+ var expr_6 = global::System.Linq.Expressions.Expression.Property(p_customer, typeof(global::Foo.Customer).GetProperty("LastName")); // customer.LastName
+ var expr_2 = global::System.Linq.Expressions.Expression.Call(typeof(string).GetMethod("Concat", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(string), typeof(string) }, null), expr_3, expr_6);
+ var expr_7 = global::System.Linq.Expressions.Expression.Property(p_customer, typeof(global::Foo.Customer).GetProperty("IsActive")); // customer.IsActive
+ var expr_10 = global::System.Linq.Expressions.Expression.Property(p_customer, typeof(global::Foo.Customer).GetProperty("Orders")); // customer.Orders
var expr_9 = global::System.Linq.Expressions.Expression.Convert(expr_10, typeof(global::System.Collections.Generic.IEnumerable));
- var expr_8 = global::System.Linq.Expressions.Expression.Call(_m1, new global::System.Linq.Expressions.Expression[] { expr_9 });
- var expr_11 = global::System.Linq.Expressions.Expression.Bind(_p5, expr_1);
- var expr_12 = global::System.Linq.Expressions.Expression.Bind(_p6, expr_2);
- var expr_13 = global::System.Linq.Expressions.Expression.Bind(_p7, expr_7);
- var expr_14 = global::System.Linq.Expressions.Expression.Bind(_p8, expr_8);
+ var expr_8 = global::System.Linq.Expressions.Expression.Call(global::System.Linq.Enumerable.First(global::System.Linq.Enumerable.Where(typeof(global::System.Linq.Enumerable).GetMethods(global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static), m => m.Name == "Count" && m.IsGenericMethodDefinition && m.GetGenericArguments().Length == 1 && m.GetParameters().Length == 1)).MakeGenericMethod(typeof(global::Foo.Order)), new global::System.Linq.Expressions.Expression[] { expr_9 });
+ var expr_11 = global::System.Linq.Expressions.Expression.Bind(typeof(global::Foo.CustomerDto).GetProperty("Id"), expr_1);
+ var expr_12 = global::System.Linq.Expressions.Expression.Bind(typeof(global::Foo.CustomerDto).GetProperty("FullName"), expr_2);
+ var expr_13 = global::System.Linq.Expressions.Expression.Bind(typeof(global::Foo.CustomerDto).GetProperty("IsActive"), expr_7);
+ var expr_14 = global::System.Linq.Expressions.Expression.Bind(typeof(global::Foo.CustomerDto).GetProperty("OrderCount"), expr_8);
var expr_15 = global::System.Linq.Expressions.Expression.MemberInit(expr_0, expr_11, expr_12, expr_13, expr_14);
return global::System.Linq.Expressions.Expression.Lambda>(expr_15, p_customer);
}
diff --git a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithIfElseLogic.verified.txt b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithIfElseLogic.verified.txt
index d5e4ca1..fc7be55 100644
--- a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithIfElseLogic.verified.txt
+++ b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithIfElseLogic.verified.txt
@@ -5,13 +5,8 @@ using Foo;
namespace ExpressiveSharp.Generated
{
- [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
- static class Foo_PersonDto__ctor_P0_int
+ static partial class Foo_PersonDto
{
- private static readonly global::System.Reflection.ConstructorInfo _c0 = typeof(global::Foo.PersonDto).GetConstructor(new global::System.Type[] { });
- private static readonly global::System.Reflection.PropertyInfo _p0 = typeof(global::Foo.PersonDto).GetProperty("Score");
- private static readonly global::System.Reflection.PropertyInfo _p1 = typeof(global::Foo.PersonDto).GetProperty("Label");
-
// [Expressive]
// public PersonDto(int score)
// {
@@ -25,17 +20,17 @@ namespace ExpressiveSharp.Generated
// Label = "B";
// }
// }
- static global::System.Linq.Expressions.Expression> Expression()
+ static global::System.Linq.Expressions.Expression> _ctor_P0_int_Expression()
{
var p_score = global::System.Linq.Expressions.Expression.Parameter(typeof(int), "score");
- var expr_0 = global::System.Linq.Expressions.Expression.New(_c0);
+ var expr_0 = global::System.Linq.Expressions.Expression.New(typeof(global::Foo.PersonDto).GetConstructor(new global::System.Type[] { }));
var expr_1 = global::System.Linq.Expressions.Expression.Constant("A", typeof(string)); // "A"
var expr_2 = global::System.Linq.Expressions.Expression.Constant("B", typeof(string)); // "B"
var expr_4 = global::System.Linq.Expressions.Expression.Constant(90, typeof(int)); // 90
var expr_3 = global::System.Linq.Expressions.Expression.MakeBinary(global::System.Linq.Expressions.ExpressionType.GreaterThanOrEqual, p_score, expr_4);
var expr_5 = global::System.Linq.Expressions.Expression.Condition(expr_3, expr_1, expr_2, typeof(string));
- var expr_6 = global::System.Linq.Expressions.Expression.Bind(_p0, p_score);
- var expr_7 = global::System.Linq.Expressions.Expression.Bind(_p1, expr_5);
+ var expr_6 = global::System.Linq.Expressions.Expression.Bind(typeof(global::Foo.PersonDto).GetProperty("Score"), p_score);
+ var expr_7 = global::System.Linq.Expressions.Expression.Bind(typeof(global::Foo.PersonDto).GetProperty("Label"), expr_5);
var expr_8 = global::System.Linq.Expressions.Expression.MemberInit(expr_0, expr_6, expr_7);
return global::System.Linq.Expressions.Expression.Lambda>(expr_8, p_score);
}
diff --git a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithIfInsideLocalScope_AndElse.verified.txt b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithIfInsideLocalScope_AndElse.verified.txt
index 501b120..16b57dd 100644
--- a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithIfInsideLocalScope_AndElse.verified.txt
+++ b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithIfInsideLocalScope_AndElse.verified.txt
@@ -5,15 +5,8 @@ using Foo;
namespace ExpressiveSharp.Generated
{
- [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
- static class Foo_OrderDto__ctor_P0_int_P1_bool
+ static partial class Foo_OrderDto
{
- private static readonly global::System.Reflection.ConstructorInfo _c0 = typeof(global::Foo.OrderDto).GetConstructor(new global::System.Type[] { });
- private static readonly global::System.Reflection.FieldInfo _f0 = typeof(string).GetField("Empty", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static);
- private static readonly global::System.Reflection.PropertyInfo _p0 = typeof(global::Foo.OrderDto).GetProperty("Status");
- private static readonly global::System.Reflection.PropertyInfo _p1 = typeof(global::Foo.OrderDto).GetProperty("Note");
- private static readonly global::System.Reflection.PropertyInfo _p2 = typeof(global::Foo.OrderDto).GetProperty("NeedsReview");
-
// [Expressive]
// public OrderDto(int amount, bool flagged)
// {
@@ -30,11 +23,11 @@ namespace ExpressiveSharp.Generated
// NeedsReview = false;
// }
// }
- static global::System.Linq.Expressions.Expression> Expression()
+ static global::System.Linq.Expressions.Expression> _ctor_P0_int_P1_bool_Expression()
{
var p_amount = global::System.Linq.Expressions.Expression.Parameter(typeof(int), "amount");
var p_flagged = global::System.Linq.Expressions.Expression.Parameter(typeof(bool), "flagged");
- var expr_0 = global::System.Linq.Expressions.Expression.New(_c0);
+ var expr_0 = global::System.Linq.Expressions.Expression.New(typeof(global::Foo.OrderDto).GetConstructor(new global::System.Type[] { }));
var expr_1 = global::System.Linq.Expressions.Expression.Constant("Flagged", typeof(string)); // "Flagged"
var expr_2 = global::System.Linq.Expressions.Expression.Constant("Requires manual review", typeof(string)); // "Requires manual review"
var expr_3 = global::System.Linq.Expressions.Expression.Constant(true, typeof(bool)); // true
@@ -43,14 +36,14 @@ namespace ExpressiveSharp.Generated
var expr_7 = global::System.Linq.Expressions.Expression.Constant("Large", typeof(string)); // "Large"
var expr_8 = global::System.Linq.Expressions.Expression.Constant("Normal", typeof(string)); // "Normal"
var expr_4 = global::System.Linq.Expressions.Expression.Condition(expr_5, expr_7, expr_8, typeof(string));
- var expr_9 = global::System.Linq.Expressions.Expression.Field(null, _f0); // string.Empty
+ var expr_9 = global::System.Linq.Expressions.Expression.Field(null, typeof(string).GetField("Empty", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static)); // string.Empty
var expr_10 = global::System.Linq.Expressions.Expression.Constant(false, typeof(bool)); // false
var expr_11 = global::System.Linq.Expressions.Expression.Condition(p_flagged, expr_1, expr_4, typeof(string));
var expr_12 = global::System.Linq.Expressions.Expression.Condition(p_flagged, expr_2, expr_9, typeof(string));
var expr_13 = global::System.Linq.Expressions.Expression.Condition(p_flagged, expr_3, expr_10, typeof(bool));
- var expr_14 = global::System.Linq.Expressions.Expression.Bind(_p0, expr_11);
- var expr_15 = global::System.Linq.Expressions.Expression.Bind(_p1, expr_12);
- var expr_16 = global::System.Linq.Expressions.Expression.Bind(_p2, expr_13);
+ var expr_14 = global::System.Linq.Expressions.Expression.Bind(typeof(global::Foo.OrderDto).GetProperty("Status"), expr_11);
+ var expr_15 = global::System.Linq.Expressions.Expression.Bind(typeof(global::Foo.OrderDto).GetProperty("Note"), expr_12);
+ var expr_16 = global::System.Linq.Expressions.Expression.Bind(typeof(global::Foo.OrderDto).GetProperty("NeedsReview"), expr_13);
var expr_17 = global::System.Linq.Expressions.Expression.MemberInit(expr_0, expr_14, expr_15, expr_16);
return global::System.Linq.Expressions.Expression.Lambda>(expr_17, p_amount, p_flagged);
}
diff --git a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithIfNoElse.verified.txt b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithIfNoElse.verified.txt
index 89979aa..e53348a 100644
--- a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithIfNoElse.verified.txt
+++ b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithIfNoElse.verified.txt
@@ -5,12 +5,8 @@ using Foo;
namespace ExpressiveSharp.Generated
{
- [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
- static class Foo_PersonDto__ctor_P0_int
+ static partial class Foo_PersonDto
{
- private static readonly global::System.Reflection.ConstructorInfo _c0 = typeof(global::Foo.PersonDto).GetConstructor(new global::System.Type[] { });
- private static readonly global::System.Reflection.PropertyInfo _p0 = typeof(global::Foo.PersonDto).GetProperty("Label");
-
// [Expressive]
// public PersonDto(int score)
// {
@@ -20,16 +16,16 @@ namespace ExpressiveSharp.Generated
// Label = "A";
// }
// }
- static global::System.Linq.Expressions.Expression> Expression()
+ static global::System.Linq.Expressions.Expression> _ctor_P0_int_Expression()
{
var p_score = global::System.Linq.Expressions.Expression.Parameter(typeof(int), "score");
- var expr_0 = global::System.Linq.Expressions.Expression.New(_c0);
+ var expr_0 = global::System.Linq.Expressions.Expression.New(typeof(global::Foo.PersonDto).GetConstructor(new global::System.Type[] { }));
var expr_1 = global::System.Linq.Expressions.Expression.Constant("none", typeof(string)); // "none"
var expr_2 = global::System.Linq.Expressions.Expression.Constant("A", typeof(string)); // "A"
var expr_4 = global::System.Linq.Expressions.Expression.Constant(90, typeof(int)); // 90
var expr_3 = global::System.Linq.Expressions.Expression.MakeBinary(global::System.Linq.Expressions.ExpressionType.GreaterThanOrEqual, p_score, expr_4);
var expr_5 = global::System.Linq.Expressions.Expression.Condition(expr_3, expr_2, expr_1, typeof(string));
- var expr_6 = global::System.Linq.Expressions.Expression.Bind(_p0, expr_5);
+ var expr_6 = global::System.Linq.Expressions.Expression.Bind(typeof(global::Foo.PersonDto).GetProperty("Label"), expr_5);
var expr_7 = global::System.Linq.Expressions.Expression.MemberInit(expr_0, expr_6);
return global::System.Linq.Expressions.Expression.Lambda>(expr_7, p_score);
}
diff --git a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithLocalVariable.verified.txt b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithLocalVariable.verified.txt
index d8962f3..9eda2f8 100644
--- a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithLocalVariable.verified.txt
+++ b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithLocalVariable.verified.txt
@@ -5,30 +5,25 @@ using Foo;
namespace ExpressiveSharp.Generated
{
- [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
- static class Foo_PersonDto__ctor_P0_string_P1_string
+ static partial class Foo_PersonDto
{
- private static readonly global::System.Reflection.ConstructorInfo _c0 = typeof(global::Foo.PersonDto).GetConstructor(new global::System.Type[] { });
- private static readonly global::System.Reflection.MethodInfo _m0 = typeof(string).GetMethod("Concat", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(string), typeof(string) }, null);
- private static readonly global::System.Reflection.PropertyInfo _p0 = typeof(global::Foo.PersonDto).GetProperty("FullName");
-
// [Expressive]
// public PersonDto(string first, string last)
// {
// var full = first + " " + last;
// FullName = full;
// }
- static global::System.Linq.Expressions.Expression> Expression()
+ static global::System.Linq.Expressions.Expression> _ctor_P0_string_P1_string_Expression()
{
var p_first = global::System.Linq.Expressions.Expression.Parameter(typeof(string), "first");
var p_last = global::System.Linq.Expressions.Expression.Parameter(typeof(string), "last");
- var expr_0 = global::System.Linq.Expressions.Expression.New(_c0);
+ var expr_0 = global::System.Linq.Expressions.Expression.New(typeof(global::Foo.PersonDto).GetConstructor(new global::System.Type[] { }));
var expr_1 = global::System.Linq.Expressions.Expression.Variable(typeof(string), "full");
var expr_4 = global::System.Linq.Expressions.Expression.Constant(" ", typeof(string)); // " "
- var expr_3 = global::System.Linq.Expressions.Expression.Call(_m0, p_first, expr_4);
- var expr_2 = global::System.Linq.Expressions.Expression.Call(_m0, expr_3, p_last);
+ var expr_3 = global::System.Linq.Expressions.Expression.Call(typeof(string).GetMethod("Concat", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(string), typeof(string) }, null), p_first, expr_4);
+ var expr_2 = global::System.Linq.Expressions.Expression.Call(typeof(string).GetMethod("Concat", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(string), typeof(string) }, null), expr_3, p_last);
var expr_5 = global::System.Linq.Expressions.Expression.Assign(expr_1, expr_2);
- var expr_6 = global::System.Linq.Expressions.Expression.Bind(_p0, expr_1);
+ var expr_6 = global::System.Linq.Expressions.Expression.Bind(typeof(global::Foo.PersonDto).GetProperty("FullName"), expr_1);
var expr_7 = global::System.Linq.Expressions.Expression.MemberInit(expr_0, expr_6);
return global::System.Linq.Expressions.Expression.Lambda>(expr_7, p_first, p_last);
}
diff --git a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithLocalVariableUsedInCondition.verified.txt b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithLocalVariableUsedInCondition.verified.txt
index 284d9be..112fc94 100644
--- a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithLocalVariableUsedInCondition.verified.txt
+++ b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithLocalVariableUsedInCondition.verified.txt
@@ -5,14 +5,8 @@ using Foo;
namespace ExpressiveSharp.Generated
{
- [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
- static class Foo_RangeDto__ctor_P0_int_P1_int
+ static partial class Foo_RangeDto
{
- private static readonly global::System.Reflection.ConstructorInfo _c0 = typeof(global::Foo.RangeDto).GetConstructor(new global::System.Type[] { });
- private static readonly global::System.Reflection.PropertyInfo _p0 = typeof(global::Foo.RangeDto).GetProperty("Min");
- private static readonly global::System.Reflection.PropertyInfo _p1 = typeof(global::Foo.RangeDto).GetProperty("Max");
- private static readonly global::System.Reflection.PropertyInfo _p2 = typeof(global::Foo.RangeDto).GetProperty("IsValid");
-
// [Expressive]
// public RangeDto(int a, int b)
// {
@@ -29,11 +23,11 @@ namespace ExpressiveSharp.Generated
// IsValid = false;
// }
// }
- static global::System.Linq.Expressions.Expression> Expression()
+ static global::System.Linq.Expressions.Expression> _ctor_P0_int_P1_int_Expression()
{
var p_a = global::System.Linq.Expressions.Expression.Parameter(typeof(int), "a");
var p_b = global::System.Linq.Expressions.Expression.Parameter(typeof(int), "b");
- var expr_0 = global::System.Linq.Expressions.Expression.New(_c0);
+ var expr_0 = global::System.Linq.Expressions.Expression.New(typeof(global::Foo.RangeDto).GetConstructor(new global::System.Type[] { }));
var expr_1 = global::System.Linq.Expressions.Expression.Variable(typeof(int), "lo");
var expr_3 = global::System.Linq.Expressions.Expression.MakeBinary(global::System.Linq.Expressions.ExpressionType.LessThan, p_a, p_b); // a < b
var expr_2 = global::System.Linq.Expressions.Expression.Condition(expr_3, p_a, p_b, typeof(int));
@@ -48,9 +42,9 @@ namespace ExpressiveSharp.Generated
var expr_13 = global::System.Linq.Expressions.Expression.Constant(0, typeof(int)); // 0
var expr_11 = global::System.Linq.Expressions.Expression.MakeBinary(global::System.Linq.Expressions.ExpressionType.GreaterThan, expr_12, expr_13);
var expr_14 = global::System.Linq.Expressions.Expression.Condition(expr_11, expr_9, expr_10, typeof(bool));
- var expr_15 = global::System.Linq.Expressions.Expression.Bind(_p0, expr_1);
- var expr_16 = global::System.Linq.Expressions.Expression.Bind(_p1, expr_5);
- var expr_17 = global::System.Linq.Expressions.Expression.Bind(_p2, expr_14);
+ var expr_15 = global::System.Linq.Expressions.Expression.Bind(typeof(global::Foo.RangeDto).GetProperty("Min"), expr_1);
+ var expr_16 = global::System.Linq.Expressions.Expression.Bind(typeof(global::Foo.RangeDto).GetProperty("Max"), expr_5);
+ var expr_17 = global::System.Linq.Expressions.Expression.Bind(typeof(global::Foo.RangeDto).GetProperty("IsValid"), expr_14);
var expr_18 = global::System.Linq.Expressions.Expression.MemberInit(expr_0, expr_15, expr_16, expr_17);
return global::System.Linq.Expressions.Expression.Lambda>(expr_18, p_a, p_b);
}
diff --git a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithMultipleClassArguments.verified.txt b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithMultipleClassArguments.verified.txt
index dd8f6f9..b4f3d10 100644
--- a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithMultipleClassArguments.verified.txt
+++ b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithMultipleClassArguments.verified.txt
@@ -5,29 +5,23 @@ using Foo;
namespace ExpressiveSharp.Generated
{
- [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
- static class Foo_PersonDto__ctor_P0_Foo_NamePart_P1_Foo_NamePart
+ static partial class Foo_PersonDto
{
- private static readonly global::System.Reflection.ConstructorInfo _c0 = typeof(global::Foo.PersonDto).GetConstructor(new global::System.Type[] { });
- private static readonly global::System.Reflection.PropertyInfo _p0 = typeof(global::Foo.NamePart).GetProperty("Value");
- private static readonly global::System.Reflection.PropertyInfo _p1 = typeof(global::Foo.PersonDto).GetProperty("FirstName");
- private static readonly global::System.Reflection.PropertyInfo _p2 = typeof(global::Foo.PersonDto).GetProperty("LastName");
-
// [Expressive]
// public PersonDto(NamePart first, NamePart last)
// {
// FirstName = first.Value;
// LastName = last.Value;
// }
- static global::System.Linq.Expressions.Expression> Expression()
+ static global::System.Linq.Expressions.Expression> _ctor_P0_Foo_NamePart_P1_Foo_NamePart_Expression()
{
var p_first = global::System.Linq.Expressions.Expression.Parameter(typeof(global::Foo.NamePart), "first");
var p_last = global::System.Linq.Expressions.Expression.Parameter(typeof(global::Foo.NamePart), "last");
- var expr_0 = global::System.Linq.Expressions.Expression.New(_c0);
- var expr_1 = global::System.Linq.Expressions.Expression.Property(p_first, _p0); // first.Value
- var expr_2 = global::System.Linq.Expressions.Expression.Property(p_last, _p0); // last.Value
- var expr_3 = global::System.Linq.Expressions.Expression.Bind(_p1, expr_1);
- var expr_4 = global::System.Linq.Expressions.Expression.Bind(_p2, expr_2);
+ var expr_0 = global::System.Linq.Expressions.Expression.New(typeof(global::Foo.PersonDto).GetConstructor(new global::System.Type[] { }));
+ var expr_1 = global::System.Linq.Expressions.Expression.Property(p_first, typeof(global::Foo.NamePart).GetProperty("Value")); // first.Value
+ var expr_2 = global::System.Linq.Expressions.Expression.Property(p_last, typeof(global::Foo.NamePart).GetProperty("Value")); // last.Value
+ var expr_3 = global::System.Linq.Expressions.Expression.Bind(typeof(global::Foo.PersonDto).GetProperty("FirstName"), expr_1);
+ var expr_4 = global::System.Linq.Expressions.Expression.Bind(typeof(global::Foo.PersonDto).GetProperty("LastName"), expr_2);
var expr_5 = global::System.Linq.Expressions.Expression.MemberInit(expr_0, expr_3, expr_4);
return global::System.Linq.Expressions.Expression.Lambda>(expr_5, p_first, p_last);
}
diff --git a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithMultipleEarlyReturns.verified.txt b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithMultipleEarlyReturns.verified.txt
index 7c56761..46362bc 100644
--- a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithMultipleEarlyReturns.verified.txt
+++ b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithMultipleEarlyReturns.verified.txt
@@ -5,12 +5,8 @@ using Foo;
namespace ExpressiveSharp.Generated
{
- [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
- static class Foo_PriorityDto__ctor_P0_int
+ static partial class Foo_PriorityDto
{
- private static readonly global::System.Reflection.ConstructorInfo _c0 = typeof(global::Foo.PriorityDto).GetConstructor(new global::System.Type[] { });
- private static readonly global::System.Reflection.PropertyInfo _p0 = typeof(global::Foo.PriorityDto).GetProperty("Level");
-
// [Expressive]
// public PriorityDto(int value)
// {
@@ -34,10 +30,10 @@ namespace ExpressiveSharp.Generated
//
// Level = "High";
// }
- static global::System.Linq.Expressions.Expression> Expression()
+ static global::System.Linq.Expressions.Expression> _ctor_P0_int_Expression()
{
var p_value = global::System.Linq.Expressions.Expression.Parameter(typeof(int), "value");
- var expr_0 = global::System.Linq.Expressions.Expression.New(_c0);
+ var expr_0 = global::System.Linq.Expressions.Expression.New(typeof(global::Foo.PriorityDto).GetConstructor(new global::System.Type[] { }));
var expr_1 = global::System.Linq.Expressions.Expression.Constant("Invalid", typeof(string)); // "Invalid"
var expr_3 = global::System.Linq.Expressions.Expression.Constant(0, typeof(int)); // 0
var expr_2 = global::System.Linq.Expressions.Expression.MakeBinary(global::System.Linq.Expressions.ExpressionType.LessThan, p_value, expr_3);
@@ -52,7 +48,7 @@ namespace ExpressiveSharp.Generated
var expr_11 = global::System.Linq.Expressions.Expression.MakeBinary(global::System.Linq.Expressions.ExpressionType.LessThanOrEqual, p_value, expr_12);
var expr_13 = global::System.Linq.Expressions.Expression.Condition(expr_11, expr_10, expr_9, typeof(string));
var expr_14 = global::System.Linq.Expressions.Expression.Constant("High", typeof(string)); // "High"
- var expr_15 = global::System.Linq.Expressions.Expression.Bind(_p0, expr_14);
+ var expr_15 = global::System.Linq.Expressions.Expression.Bind(typeof(global::Foo.PriorityDto).GetProperty("Level"), expr_14);
var expr_16 = global::System.Linq.Expressions.Expression.MemberInit(expr_0, expr_15);
return global::System.Linq.Expressions.Expression.Lambda>(expr_16, p_value);
}
diff --git a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithMultipleLocalVariables.verified.txt b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithMultipleLocalVariables.verified.txt
index ad593df..2434659 100644
--- a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithMultipleLocalVariables.verified.txt
+++ b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithMultipleLocalVariables.verified.txt
@@ -5,16 +5,8 @@ using Foo;
namespace ExpressiveSharp.Generated
{
- [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
- static class Foo_AddressDto__ctor_P0_string_P1_string_P2_string
+ static partial class Foo_AddressDto
{
- private static readonly global::System.Reflection.ConstructorInfo _c0 = typeof(global::Foo.AddressDto).GetConstructor(new global::System.Type[] { });
- private static readonly global::System.Reflection.MethodInfo _m0 = typeof(string).GetMethod("Trim", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { }, null);
- private static readonly global::System.Reflection.MethodInfo _m1 = typeof(string).GetMethod("Concat", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(string), typeof(string) }, null);
- private static readonly global::System.Reflection.PropertyInfo _p0 = typeof(global::Foo.AddressDto).GetProperty("Street");
- private static readonly global::System.Reflection.PropertyInfo _p1 = typeof(global::Foo.AddressDto).GetProperty("City");
- private static readonly global::System.Reflection.PropertyInfo _p2 = typeof(global::Foo.AddressDto).GetProperty("Full");
-
// [Expressive]
// public AddressDto(string street, string city, string country)
// {
@@ -24,27 +16,27 @@ namespace ExpressiveSharp.Generated
// City = trimmedCity;
// Full = trimmedStreet + ", " + trimmedCity + ", " + country;
// }
- static global::System.Linq.Expressions.Expression> Expression()
+ static global::System.Linq.Expressions.Expression> _ctor_P0_string_P1_string_P2_string_Expression()
{
var p_street = global::System.Linq.Expressions.Expression.Parameter(typeof(string), "street");
var p_city = global::System.Linq.Expressions.Expression.Parameter(typeof(string), "city");
var p_country = global::System.Linq.Expressions.Expression.Parameter(typeof(string), "country");
- var expr_0 = global::System.Linq.Expressions.Expression.New(_c0);
+ var expr_0 = global::System.Linq.Expressions.Expression.New(typeof(global::Foo.AddressDto).GetConstructor(new global::System.Type[] { }));
var expr_1 = global::System.Linq.Expressions.Expression.Variable(typeof(string), "trimmedStreet");
- var expr_2 = global::System.Linq.Expressions.Expression.Call(p_street, _m0, global::System.Array.Empty()); // street.Trim()
+ var expr_2 = global::System.Linq.Expressions.Expression.Call(p_street, typeof(string).GetMethod("Trim", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { }, null), global::System.Array.Empty()); // street.Trim()
var expr_3 = global::System.Linq.Expressions.Expression.Assign(expr_1, expr_2);
var expr_4 = global::System.Linq.Expressions.Expression.Variable(typeof(string), "trimmedCity");
- var expr_5 = global::System.Linq.Expressions.Expression.Call(p_city, _m0, global::System.Array.Empty()); // city.Trim()
+ var expr_5 = global::System.Linq.Expressions.Expression.Call(p_city, typeof(string).GetMethod("Trim", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { }, null), global::System.Array.Empty()); // city.Trim()
var expr_6 = global::System.Linq.Expressions.Expression.Assign(expr_4, expr_5);
var expr_11 = global::System.Linq.Expressions.Expression.Constant(", ", typeof(string)); // ", "
- var expr_10 = global::System.Linq.Expressions.Expression.Call(_m1, expr_1, expr_11);
- var expr_9 = global::System.Linq.Expressions.Expression.Call(_m1, expr_10, expr_4);
+ var expr_10 = global::System.Linq.Expressions.Expression.Call(typeof(string).GetMethod("Concat", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(string), typeof(string) }, null), expr_1, expr_11);
+ var expr_9 = global::System.Linq.Expressions.Expression.Call(typeof(string).GetMethod("Concat", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(string), typeof(string) }, null), expr_10, expr_4);
var expr_12 = global::System.Linq.Expressions.Expression.Constant(", ", typeof(string)); // ", "
- var expr_8 = global::System.Linq.Expressions.Expression.Call(_m1, expr_9, expr_12);
- var expr_7 = global::System.Linq.Expressions.Expression.Call(_m1, expr_8, p_country);
- var expr_13 = global::System.Linq.Expressions.Expression.Bind(_p0, expr_1);
- var expr_14 = global::System.Linq.Expressions.Expression.Bind(_p1, expr_4);
- var expr_15 = global::System.Linq.Expressions.Expression.Bind(_p2, expr_7);
+ var expr_8 = global::System.Linq.Expressions.Expression.Call(typeof(string).GetMethod("Concat", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(string), typeof(string) }, null), expr_9, expr_12);
+ var expr_7 = global::System.Linq.Expressions.Expression.Call(typeof(string).GetMethod("Concat", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(string), typeof(string) }, null), expr_8, p_country);
+ var expr_13 = global::System.Linq.Expressions.Expression.Bind(typeof(global::Foo.AddressDto).GetProperty("Street"), expr_1);
+ var expr_14 = global::System.Linq.Expressions.Expression.Bind(typeof(global::Foo.AddressDto).GetProperty("City"), expr_4);
+ var expr_15 = global::System.Linq.Expressions.Expression.Bind(typeof(global::Foo.AddressDto).GetProperty("Full"), expr_7);
var expr_16 = global::System.Linq.Expressions.Expression.MemberInit(expr_0, expr_13, expr_14, expr_15);
return global::System.Linq.Expressions.Expression.Lambda>(expr_16, p_street, p_city, p_country);
}
diff --git a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithNestedIfElse.verified.txt b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithNestedIfElse.verified.txt
index 990e2c4..4b78488 100644
--- a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithNestedIfElse.verified.txt
+++ b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithNestedIfElse.verified.txt
@@ -5,12 +5,8 @@ using Foo;
namespace ExpressiveSharp.Generated
{
- [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
- static class Foo_StatusDto__ctor_P0_bool_P1_bool
+ static partial class Foo_StatusDto
{
- private static readonly global::System.Reflection.ConstructorInfo _c0 = typeof(global::Foo.StatusDto).GetConstructor(new global::System.Type[] { });
- private static readonly global::System.Reflection.PropertyInfo _p0 = typeof(global::Foo.StatusDto).GetProperty("Status");
-
// [Expressive]
// public StatusDto(bool isActive, bool isPremium)
// {
@@ -30,17 +26,17 @@ namespace ExpressiveSharp.Generated
// Status = "Inactive";
// }
// }
- static global::System.Linq.Expressions.Expression> Expression()
+ static global::System.Linq.Expressions.Expression> _ctor_P0_bool_P1_bool_Expression()
{
var p_isActive = global::System.Linq.Expressions.Expression.Parameter(typeof(bool), "isActive");
var p_isPremium = global::System.Linq.Expressions.Expression.Parameter(typeof(bool), "isPremium");
- var expr_0 = global::System.Linq.Expressions.Expression.New(_c0);
+ var expr_0 = global::System.Linq.Expressions.Expression.New(typeof(global::Foo.StatusDto).GetConstructor(new global::System.Type[] { }));
var expr_1 = global::System.Linq.Expressions.Expression.Constant("Active Premium", typeof(string)); // "Active Premium"
var expr_2 = global::System.Linq.Expressions.Expression.Constant("Active Free", typeof(string)); // "Active Free"
var expr_3 = global::System.Linq.Expressions.Expression.Condition(p_isPremium, expr_1, expr_2, typeof(string));
var expr_4 = global::System.Linq.Expressions.Expression.Constant("Inactive", typeof(string)); // "Inactive"
var expr_5 = global::System.Linq.Expressions.Expression.Condition(p_isActive, expr_3, expr_4, typeof(string));
- var expr_6 = global::System.Linq.Expressions.Expression.Bind(_p0, expr_5);
+ var expr_6 = global::System.Linq.Expressions.Expression.Bind(typeof(global::Foo.StatusDto).GetProperty("Status"), expr_5);
var expr_7 = global::System.Linq.Expressions.Expression.MemberInit(expr_0, expr_6);
return global::System.Linq.Expressions.Expression.Lambda>(expr_7, p_isActive, p_isPremium);
}
diff --git a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithNullCoalescing.verified.txt b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithNullCoalescing.verified.txt
index 5063ae1..54638f9 100644
--- a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithNullCoalescing.verified.txt
+++ b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithNullCoalescing.verified.txt
@@ -5,31 +5,25 @@ using Foo;
namespace ExpressiveSharp.Generated
{
- [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
- static class Foo_ProductDto__ctor_P0_string_P1_string
+ static partial class Foo_ProductDto
{
- private static readonly global::System.Reflection.ConstructorInfo _c0 = typeof(global::Foo.ProductDto).GetConstructor(new global::System.Type[] { });
- private static readonly global::System.Reflection.FieldInfo _f0 = typeof(string).GetField("Empty", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static);
- private static readonly global::System.Reflection.PropertyInfo _p0 = typeof(global::Foo.ProductDto).GetProperty("Name");
- private static readonly global::System.Reflection.PropertyInfo _p1 = typeof(global::Foo.ProductDto).GetProperty("Description");
-
// [Expressive]
// public ProductDto(string name, string description)
// {
// Name = name ?? "Unnamed";
// Description = description ?? string.Empty;
// }
- static global::System.Linq.Expressions.Expression> Expression()
+ static global::System.Linq.Expressions.Expression> _ctor_P0_string_P1_string_Expression()
{
var p_name = global::System.Linq.Expressions.Expression.Parameter(typeof(string), "name");
var p_description = global::System.Linq.Expressions.Expression.Parameter(typeof(string), "description");
- var expr_0 = global::System.Linq.Expressions.Expression.New(_c0);
+ var expr_0 = global::System.Linq.Expressions.Expression.New(typeof(global::Foo.ProductDto).GetConstructor(new global::System.Type[] { }));
var expr_2 = global::System.Linq.Expressions.Expression.Constant("Unnamed", typeof(string)); // "Unnamed"
var expr_1 = global::System.Linq.Expressions.Expression.Coalesce(p_name, expr_2);
- var expr_4 = global::System.Linq.Expressions.Expression.Field(null, _f0); // string.Empty
+ var expr_4 = global::System.Linq.Expressions.Expression.Field(null, typeof(string).GetField("Empty", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static)); // string.Empty
var expr_3 = global::System.Linq.Expressions.Expression.Coalesce(p_description, expr_4);
- var expr_5 = global::System.Linq.Expressions.Expression.Bind(_p0, expr_1);
- var expr_6 = global::System.Linq.Expressions.Expression.Bind(_p1, expr_3);
+ var expr_5 = global::System.Linq.Expressions.Expression.Bind(typeof(global::Foo.ProductDto).GetProperty("Name"), expr_1);
+ var expr_6 = global::System.Linq.Expressions.Expression.Bind(typeof(global::Foo.ProductDto).GetProperty("Description"), expr_3);
var expr_7 = global::System.Linq.Expressions.Expression.MemberInit(expr_0, expr_5, expr_6);
return global::System.Linq.Expressions.Expression.Lambda>(expr_7, p_name, p_description);
}
diff --git a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithNullableParameter.verified.txt b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithNullableParameter.verified.txt
index 1cba29f..7856083 100644
--- a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithNullableParameter.verified.txt
+++ b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithNullableParameter.verified.txt
@@ -5,30 +5,25 @@ using Foo;
namespace ExpressiveSharp.Generated
{
- [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
- static class Foo_MeasurementDto__ctor_P0_double__P1_string
+ static partial class Foo_MeasurementDto
{
- private static readonly global::System.Reflection.ConstructorInfo _c0 = typeof(global::Foo.MeasurementDto).GetConstructor(new global::System.Type[] { });
- private static readonly global::System.Reflection.PropertyInfo _p0 = typeof(global::Foo.MeasurementDto).GetProperty("Value");
- private static readonly global::System.Reflection.PropertyInfo _p1 = typeof(global::Foo.MeasurementDto).GetProperty("Unit");
-
// [Expressive]
// public MeasurementDto(double? value, string unit)
// {
// Value = value ?? 0.0;
// Unit = unit ?? "m";
// }
- static global::System.Linq.Expressions.Expression> Expression()
+ static global::System.Linq.Expressions.Expression> _ctor_P0_double__P1_string_Expression()
{
var p_value = global::System.Linq.Expressions.Expression.Parameter(typeof(double?), "value");
var p_unit = global::System.Linq.Expressions.Expression.Parameter(typeof(string), "unit");
- var expr_0 = global::System.Linq.Expressions.Expression.New(_c0);
+ var expr_0 = global::System.Linq.Expressions.Expression.New(typeof(global::Foo.MeasurementDto).GetConstructor(new global::System.Type[] { }));
var expr_2 = global::System.Linq.Expressions.Expression.Constant(0d, typeof(double)); // 0.0
var expr_1 = global::System.Linq.Expressions.Expression.Coalesce(p_value, expr_2);
var expr_4 = global::System.Linq.Expressions.Expression.Constant("m", typeof(string)); // "m"
var expr_3 = global::System.Linq.Expressions.Expression.Coalesce(p_unit, expr_4);
- var expr_5 = global::System.Linq.Expressions.Expression.Bind(_p0, expr_1);
- var expr_6 = global::System.Linq.Expressions.Expression.Bind(_p1, expr_3);
+ var expr_5 = global::System.Linq.Expressions.Expression.Bind(typeof(global::Foo.MeasurementDto).GetProperty("Value"), expr_1);
+ var expr_6 = global::System.Linq.Expressions.Expression.Bind(typeof(global::Foo.MeasurementDto).GetProperty("Unit"), expr_3);
var expr_7 = global::System.Linq.Expressions.Expression.MemberInit(expr_0, expr_5, expr_6);
return global::System.Linq.Expressions.Expression.Lambda>(expr_7, p_value, p_unit);
}
diff --git a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithSequentialIfs.verified.txt b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithSequentialIfs.verified.txt
index 3d31e29..fe3fa07 100644
--- a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithSequentialIfs.verified.txt
+++ b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithSequentialIfs.verified.txt
@@ -5,14 +5,8 @@ using Foo;
namespace ExpressiveSharp.Generated
{
- [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
- static class Foo_FlagDto__ctor_P0_string_P1_bool
+ static partial class Foo_FlagDto
{
- private static readonly global::System.Reflection.ConstructorInfo _c0 = typeof(global::Foo.FlagDto).GetConstructor(new global::System.Type[] { });
- private static readonly global::System.Reflection.PropertyInfo _p0 = typeof(global::Foo.FlagDto).GetProperty("Tag");
- private static readonly global::System.Reflection.PropertyInfo _p1 = typeof(global::Foo.FlagDto).GetProperty("IsVerified");
- private static readonly global::System.Reflection.PropertyInfo _p2 = typeof(global::Foo.FlagDto).GetProperty("IsAdmin");
-
// [Expressive]
// public FlagDto(string role, bool verified)
// {
@@ -27,11 +21,11 @@ namespace ExpressiveSharp.Generated
// IsAdmin = true;
// }
// }
- static global::System.Linq.Expressions.Expression> Expression()
+ static global::System.Linq.Expressions.Expression> _ctor_P0_string_P1_bool_Expression()
{
var p_role = global::System.Linq.Expressions.Expression.Parameter(typeof(string), "role");
var p_verified = global::System.Linq.Expressions.Expression.Parameter(typeof(bool), "verified");
- var expr_0 = global::System.Linq.Expressions.Expression.New(_c0);
+ var expr_0 = global::System.Linq.Expressions.Expression.New(typeof(global::Foo.FlagDto).GetConstructor(new global::System.Type[] { }));
var expr_1 = global::System.Linq.Expressions.Expression.Constant(true, typeof(bool)); // true
var expr_2 = global::System.Linq.Expressions.Expression.Default(typeof(bool));
var expr_3 = global::System.Linq.Expressions.Expression.Condition(p_verified, expr_1, expr_2, typeof(bool));
@@ -40,9 +34,9 @@ namespace ExpressiveSharp.Generated
var expr_5 = global::System.Linq.Expressions.Expression.MakeBinary(global::System.Linq.Expressions.ExpressionType.Equal, p_role, expr_6);
var expr_7 = global::System.Linq.Expressions.Expression.Default(typeof(bool));
var expr_8 = global::System.Linq.Expressions.Expression.Condition(expr_5, expr_4, expr_7, typeof(bool));
- var expr_9 = global::System.Linq.Expressions.Expression.Bind(_p0, p_role);
- var expr_10 = global::System.Linq.Expressions.Expression.Bind(_p1, expr_3);
- var expr_11 = global::System.Linq.Expressions.Expression.Bind(_p2, expr_8);
+ var expr_9 = global::System.Linq.Expressions.Expression.Bind(typeof(global::Foo.FlagDto).GetProperty("Tag"), p_role);
+ var expr_10 = global::System.Linq.Expressions.Expression.Bind(typeof(global::Foo.FlagDto).GetProperty("IsVerified"), expr_3);
+ var expr_11 = global::System.Linq.Expressions.Expression.Bind(typeof(global::Foo.FlagDto).GetProperty("IsAdmin"), expr_8);
var expr_12 = global::System.Linq.Expressions.Expression.MemberInit(expr_0, expr_9, expr_10, expr_11);
return global::System.Linq.Expressions.Expression.Lambda>(expr_12, p_role, p_verified);
}
diff --git a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithSwitchExpression.verified.txt b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithSwitchExpression.verified.txt
index 34f31e5..ef791fd 100644
--- a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithSwitchExpression.verified.txt
+++ b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithSwitchExpression.verified.txt
@@ -5,14 +5,8 @@ using Foo;
namespace ExpressiveSharp.Generated
{
- [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
- static class Foo_SeasonDto__ctor_P0_int
+ static partial class Foo_SeasonDto
{
- private static readonly global::System.Reflection.ConstructorInfo _c0 = typeof(global::Foo.SeasonDto).GetConstructor(new global::System.Type[] { });
- private static readonly global::System.Reflection.MethodInfo _m0 = typeof(string).GetMethod("Concat", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(object), typeof(object) }, null);
- private static readonly global::System.Reflection.PropertyInfo _p0 = typeof(global::Foo.SeasonDto).GetProperty("Name");
- private static readonly global::System.Reflection.PropertyInfo _p1 = typeof(global::Foo.SeasonDto).GetProperty("Description");
-
// [Expressive]
// public SeasonDto(int month)
// {
@@ -25,10 +19,10 @@ namespace ExpressiveSharp.Generated
// };
// Description = "Month: " + month;
// }
- static global::System.Linq.Expressions.Expression> Expression()
+ static global::System.Linq.Expressions.Expression> _ctor_P0_int_Expression()
{
var p_month = global::System.Linq.Expressions.Expression.Parameter(typeof(int), "month");
- var expr_0 = global::System.Linq.Expressions.Expression.New(_c0);
+ var expr_0 = global::System.Linq.Expressions.Expression.New(typeof(global::Foo.SeasonDto).GetConstructor(new global::System.Type[] { }));
var expr_1 = global::System.Linq.Expressions.Expression.Constant("Autumn", typeof(string)); // "Autumn"
var expr_5 = global::System.Linq.Expressions.Expression.Constant(6, typeof(int)); // 6
var expr_4 = global::System.Linq.Expressions.Expression.Equal(p_month, expr_5);
@@ -62,9 +56,9 @@ namespace ExpressiveSharp.Generated
var expr_31 = global::System.Linq.Expressions.Expression.Condition(expr_22, expr_30, expr_21, typeof(string));
var expr_33 = global::System.Linq.Expressions.Expression.Constant("Month: ", typeof(string)); // "Month: "
var expr_34 = global::System.Linq.Expressions.Expression.Convert(p_month, typeof(object)); // month
- var expr_32 = global::System.Linq.Expressions.Expression.Call(_m0, expr_33, expr_34);
- var expr_35 = global::System.Linq.Expressions.Expression.Bind(_p0, expr_31);
- var expr_36 = global::System.Linq.Expressions.Expression.Bind(_p1, expr_32);
+ var expr_32 = global::System.Linq.Expressions.Expression.Call(typeof(string).GetMethod("Concat", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(object), typeof(object) }, null), expr_33, expr_34);
+ var expr_35 = global::System.Linq.Expressions.Expression.Bind(typeof(global::Foo.SeasonDto).GetProperty("Name"), expr_31);
+ var expr_36 = global::System.Linq.Expressions.Expression.Bind(typeof(global::Foo.SeasonDto).GetProperty("Description"), expr_32);
var expr_37 = global::System.Linq.Expressions.Expression.MemberInit(expr_0, expr_35, expr_36);
return global::System.Linq.Expressions.Expression.Lambda>(expr_37, p_month);
}
diff --git a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithSwitchExpression_AndExtraProperty.verified.txt b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithSwitchExpression_AndExtraProperty.verified.txt
index 96f4743..684a87f 100644
--- a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithSwitchExpression_AndExtraProperty.verified.txt
+++ b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithSwitchExpression_AndExtraProperty.verified.txt
@@ -5,16 +5,8 @@ using Foo;
namespace ExpressiveSharp.Generated
{
- [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
- static class Foo_ShapeDto__ctor_P0_int
+ static partial class Foo_ShapeDto
{
- private static readonly global::System.Reflection.ConstructorInfo _c0 = typeof(global::Foo.ShapeDto).GetConstructor(new global::System.Type[] { });
- private static readonly global::System.Reflection.PropertyInfo _p0 = typeof(global::Foo.ShapeDto).GetProperty("ShapeType");
- private static readonly global::System.Reflection.MethodInfo _m0 = typeof(string).GetMethod("Concat", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(string), typeof(string) }, null);
- private static readonly global::System.Reflection.MethodInfo _m1 = typeof(string).GetMethod("Concat", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(object), typeof(object) }, null);
- private static readonly global::System.Reflection.PropertyInfo _p1 = typeof(global::Foo.ShapeDto).GetProperty("Sides");
- private static readonly global::System.Reflection.PropertyInfo _p2 = typeof(global::Foo.ShapeDto).GetProperty("Description");
-
// [Expressive]
// public ShapeDto(int sides)
// {
@@ -28,10 +20,10 @@ namespace ExpressiveSharp.Generated
// };
// Description = ShapeType + " with " + sides + " sides";
// }
- static global::System.Linq.Expressions.Expression> Expression()
+ static global::System.Linq.Expressions.Expression> _ctor_P0_int_Expression()
{
var p_sides = global::System.Linq.Expressions.Expression.Parameter(typeof(int), "sides");
- var expr_0 = global::System.Linq.Expressions.Expression.New(_c0);
+ var expr_0 = global::System.Linq.Expressions.Expression.New(typeof(global::Foo.ShapeDto).GetConstructor(new global::System.Type[] { }));
var expr_1 = global::System.Linq.Expressions.Expression.Constant("Polygon", typeof(string)); // "Polygon"
var expr_3 = global::System.Linq.Expressions.Expression.Constant(5, typeof(int)); // 5
var expr_2 = global::System.Linq.Expressions.Expression.Equal(p_sides, expr_3);
@@ -46,16 +38,16 @@ namespace ExpressiveSharp.Generated
var expr_12 = global::System.Linq.Expressions.Expression.Constant("Triangle", typeof(string)); // "Triangle"
var expr_13 = global::System.Linq.Expressions.Expression.Condition(expr_10, expr_12, expr_9, typeof(string));
var p___this = global::System.Linq.Expressions.Expression.Parameter(typeof(object), "@this"); // ShapeType
- var expr_17 = global::System.Linq.Expressions.Expression.Property(p___this, _p0);
+ var expr_17 = global::System.Linq.Expressions.Expression.Property(p___this, typeof(global::Foo.ShapeDto).GetProperty("ShapeType"));
var expr_18 = global::System.Linq.Expressions.Expression.Constant(" with ", typeof(string)); // " with "
- var expr_16 = global::System.Linq.Expressions.Expression.Call(_m0, expr_17, expr_18);
+ var expr_16 = global::System.Linq.Expressions.Expression.Call(typeof(string).GetMethod("Concat", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(string), typeof(string) }, null), expr_17, expr_18);
var expr_19 = global::System.Linq.Expressions.Expression.Convert(p_sides, typeof(object)); // sides
- var expr_15 = global::System.Linq.Expressions.Expression.Call(_m1, expr_16, expr_19);
+ var expr_15 = global::System.Linq.Expressions.Expression.Call(typeof(string).GetMethod("Concat", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(object), typeof(object) }, null), expr_16, expr_19);
var expr_20 = global::System.Linq.Expressions.Expression.Constant(" sides", typeof(string)); // " sides"
- var expr_14 = global::System.Linq.Expressions.Expression.Call(_m0, expr_15, expr_20);
- var expr_21 = global::System.Linq.Expressions.Expression.Bind(_p1, p_sides);
- var expr_22 = global::System.Linq.Expressions.Expression.Bind(_p0, expr_13);
- var expr_23 = global::System.Linq.Expressions.Expression.Bind(_p2, expr_14);
+ var expr_14 = global::System.Linq.Expressions.Expression.Call(typeof(string).GetMethod("Concat", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(string), typeof(string) }, null), expr_15, expr_20);
+ var expr_21 = global::System.Linq.Expressions.Expression.Bind(typeof(global::Foo.ShapeDto).GetProperty("Sides"), p_sides);
+ var expr_22 = global::System.Linq.Expressions.Expression.Bind(typeof(global::Foo.ShapeDto).GetProperty("ShapeType"), expr_13);
+ var expr_23 = global::System.Linq.Expressions.Expression.Bind(typeof(global::Foo.ShapeDto).GetProperty("Description"), expr_14);
var expr_24 = global::System.Linq.Expressions.Expression.MemberInit(expr_0, expr_21, expr_22, expr_23);
return global::System.Linq.Expressions.Expression.Lambda>(expr_24, p_sides);
}
diff --git a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithTernaryAssignment.verified.txt b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithTernaryAssignment.verified.txt
index e6ff06b..ce31911 100644
--- a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithTernaryAssignment.verified.txt
+++ b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithTernaryAssignment.verified.txt
@@ -5,31 +5,24 @@ using Foo;
namespace ExpressiveSharp.Generated
{
- [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
- static class Foo_LabelDto__ctor_P0_string_P1_bool
+ static partial class Foo_LabelDto
{
- private static readonly global::System.Reflection.ConstructorInfo _c0 = typeof(global::Foo.LabelDto).GetConstructor(new global::System.Type[] { });
- private static readonly global::System.Reflection.MethodInfo _m0 = typeof(string).GetMethod("ToUpper", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { }, null);
- private static readonly global::System.Reflection.MethodInfo _m1 = typeof(string).GetMethod("ToLower", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { }, null);
- private static readonly global::System.Reflection.PropertyInfo _p0 = typeof(global::Foo.LabelDto).GetProperty("Label");
- private static readonly global::System.Reflection.PropertyInfo _p1 = typeof(global::Foo.LabelDto).GetProperty("Display");
-
// [Expressive]
// public LabelDto(string name, bool uppercase)
// {
// Label = name;
// Display = uppercase ? name.ToUpper() : name.ToLower();
// }
- static global::System.Linq.Expressions.Expression> Expression()
+ static global::System.Linq.Expressions.Expression> _ctor_P0_string_P1_bool_Expression()
{
var p_name = global::System.Linq.Expressions.Expression.Parameter(typeof(string), "name");
var p_uppercase = global::System.Linq.Expressions.Expression.Parameter(typeof(bool), "uppercase");
- var expr_0 = global::System.Linq.Expressions.Expression.New(_c0);
- var expr_2 = global::System.Linq.Expressions.Expression.Call(p_name, _m0, global::System.Array.Empty()); // name.ToUpper()
- var expr_3 = global::System.Linq.Expressions.Expression.Call(p_name, _m1, global::System.Array.Empty()); // name.ToLower()
+ var expr_0 = global::System.Linq.Expressions.Expression.New(typeof(global::Foo.LabelDto).GetConstructor(new global::System.Type[] { }));
+ var expr_2 = global::System.Linq.Expressions.Expression.Call(p_name, typeof(string).GetMethod("ToUpper", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { }, null), global::System.Array.Empty()); // name.ToUpper()
+ var expr_3 = global::System.Linq.Expressions.Expression.Call(p_name, typeof(string).GetMethod("ToLower", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { }, null), global::System.Array.Empty()); // name.ToLower()
var expr_1 = global::System.Linq.Expressions.Expression.Condition(p_uppercase, expr_2, expr_3, typeof(string));
- var expr_4 = global::System.Linq.Expressions.Expression.Bind(_p0, p_name);
- var expr_5 = global::System.Linq.Expressions.Expression.Bind(_p1, expr_1);
+ var expr_4 = global::System.Linq.Expressions.Expression.Bind(typeof(global::Foo.LabelDto).GetProperty("Label"), p_name);
+ var expr_5 = global::System.Linq.Expressions.Expression.Bind(typeof(global::Foo.LabelDto).GetProperty("Display"), expr_1);
var expr_6 = global::System.Linq.Expressions.Expression.MemberInit(expr_0, expr_4, expr_5);
return global::System.Linq.Expressions.Expression.Lambda>(expr_6, p_name, p_uppercase);
}
diff --git a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithThisInitializer_AndElseIfInBody.verified.txt b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithThisInitializer_AndElseIfInBody.verified.txt
index 8368c72..0e82837 100644
--- a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithThisInitializer_AndElseIfInBody.verified.txt
+++ b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ConstructorTests.ProjectableConstructor_WithThisInitializer_AndElseIfInBody.verified.txt
@@ -5,12 +5,8 @@ using Foo;
namespace ExpressiveSharp.Generated
{
- [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
- static class Foo_EventDto__ctor_P0_string_P1_string_P2_int
+ static partial class Foo_EventDto
{
- private static readonly global::System.Reflection.ConstructorInfo _c0 = typeof(global::Foo.EventDto).GetConstructor(new global::System.Type[] { });
- private static readonly global::System.Reflection.PropertyInfo _p0 = typeof(global::Foo.EventDto).GetProperty("Priority");
-
// [Expressive]
// public EventDto(string title, string tag, int urgency) : this(title, tag)
// {
@@ -27,12 +23,12 @@ namespace ExpressiveSharp.Generated
// Priority = "Normal";
// }
// }
- static global::System.Linq.Expressions.Expression> Expression()
+ static global::System.Linq.Expressions.Expression> _ctor_P0_string_P1_string_P2_int_Expression()
{
var p_title = global::System.Linq.Expressions.Expression.Parameter(typeof(string), "title");
var p_tag = global::System.Linq.Expressions.Expression.Parameter(typeof(string), "tag");
var p_urgency = global::System.Linq.Expressions.Expression.Parameter(typeof(int), "urgency");
- var expr_0 = global::System.Linq.Expressions.Expression.New(_c0);
+ var expr_0 = global::System.Linq.Expressions.Expression.New(typeof(global::Foo.EventDto).GetConstructor(new global::System.Type[] { }));
var expr_1 = global::System.Linq.Expressions.Expression.Constant("Critical", typeof(string)); // "Critical"
var expr_2 = global::System.Linq.Expressions.Expression.Constant("High", typeof(string)); // "High"
var expr_3 = global::System.Linq.Expressions.Expression.Constant("Normal", typeof(string)); // "Normal"
@@ -42,7 +38,7 @@ namespace ExpressiveSharp.Generated
var expr_8 = global::System.Linq.Expressions.Expression.Constant(10, typeof(int)); // 10
var expr_7 = global::System.Linq.Expressions.Expression.MakeBinary(global::System.Linq.Expressions.ExpressionType.GreaterThanOrEqual, p_urgency, expr_8);
var expr_9 = global::System.Linq.Expressions.Expression.Condition(expr_7, expr_1, expr_6, typeof(string));
- var expr_10 = global::System.Linq.Expressions.Expression.Bind(_p0, expr_9);
+ var expr_10 = global::System.Linq.Expressions.Expression.Bind(typeof(global::Foo.EventDto).GetProperty("Priority"), expr_9);
var expr_11 = global::System.Linq.Expressions.Expression.MemberInit(expr_0, expr_10);
return global::System.Linq.Expressions.Expression.Lambda>(expr_11, p_title, p_tag, p_urgency);
}
diff --git a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/EnumTests.ExpandEnumMethodsReturningBoolean.verified.txt b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/EnumTests.ExpandEnumMethodsReturningBoolean.verified.txt
index 89f875f..31fee87 100644
--- a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/EnumTests.ExpandEnumMethodsReturningBoolean.verified.txt
+++ b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/EnumTests.ExpandEnumMethodsReturningBoolean.verified.txt
@@ -5,29 +5,25 @@ using Foo;
namespace ExpressiveSharp.Generated
{
- [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
- static class Foo_Entity_IsStatusApproved
+ static partial class Foo_Entity
{
- private static readonly global::System.Reflection.PropertyInfo _p0 = typeof(global::Foo.Entity).GetProperty("Status");
- private static readonly global::System.Reflection.MethodInfo _m0 = typeof(global::Foo.EnumExtensions).GetMethod("IsApproved", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(global::Foo.Status) }, null);
-
// [Expressive]
// public bool IsStatusApproved => Status.IsApproved();
- static global::System.Linq.Expressions.Expression> Expression()
+ static global::System.Linq.Expressions.Expression> IsStatusApproved_Expression()
{
var p__this = global::System.Linq.Expressions.Expression.Parameter(typeof(global::Foo.Entity), "@this");
- var expr_0 = global::System.Linq.Expressions.Expression.Property(p__this, _p0); // Status
+ var expr_0 = global::System.Linq.Expressions.Expression.Property(p__this, typeof(global::Foo.Entity).GetProperty("Status")); // Status
var expr_1 = global::System.Linq.Expressions.Expression.Default(typeof(bool));
var expr_2 = global::System.Linq.Expressions.Expression.Constant(global::Foo.Status.Rejected, typeof(global::Foo.Status));
- var expr_3 = global::System.Linq.Expressions.Expression.Call(_m0, new global::System.Linq.Expressions.Expression[] { expr_2 });
+ var expr_3 = global::System.Linq.Expressions.Expression.Call(typeof(global::Foo.EnumExtensions).GetMethod("IsApproved", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(global::Foo.Status) }, null), new global::System.Linq.Expressions.Expression[] { expr_2 });
var expr_4 = global::System.Linq.Expressions.Expression.Equal(expr_0, expr_2);
var expr_5 = global::System.Linq.Expressions.Expression.Condition(expr_4, expr_3, expr_1, typeof(bool));
var expr_6 = global::System.Linq.Expressions.Expression.Constant(global::Foo.Status.Approved, typeof(global::Foo.Status));
- var expr_7 = global::System.Linq.Expressions.Expression.Call(_m0, new global::System.Linq.Expressions.Expression[] { expr_6 });
+ var expr_7 = global::System.Linq.Expressions.Expression.Call(typeof(global::Foo.EnumExtensions).GetMethod("IsApproved", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(global::Foo.Status) }, null), new global::System.Linq.Expressions.Expression[] { expr_6 });
var expr_8 = global::System.Linq.Expressions.Expression.Equal(expr_0, expr_6);
var expr_9 = global::System.Linq.Expressions.Expression.Condition(expr_8, expr_7, expr_5, typeof(bool));
var expr_10 = global::System.Linq.Expressions.Expression.Constant(global::Foo.Status.Pending, typeof(global::Foo.Status));
- var expr_11 = global::System.Linq.Expressions.Expression.Call(_m0, new global::System.Linq.Expressions.Expression[] { expr_10 });
+ var expr_11 = global::System.Linq.Expressions.Expression.Call(typeof(global::Foo.EnumExtensions).GetMethod("IsApproved", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(global::Foo.Status) }, null), new global::System.Linq.Expressions.Expression[] { expr_10 });
var expr_12 = global::System.Linq.Expressions.Expression.Equal(expr_0, expr_10);
var expr_13 = global::System.Linq.Expressions.Expression.Condition(expr_12, expr_11, expr_9, typeof(bool));
return global::System.Linq.Expressions.Expression.Lambda>(expr_13, p__this);
diff --git a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/EnumTests.ExpandEnumMethodsReturningInteger.verified.txt b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/EnumTests.ExpandEnumMethodsReturningInteger.verified.txt
index ce264a0..e475327 100644
--- a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/EnumTests.ExpandEnumMethodsReturningInteger.verified.txt
+++ b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/EnumTests.ExpandEnumMethodsReturningInteger.verified.txt
@@ -5,29 +5,25 @@ using Foo;
namespace ExpressiveSharp.Generated
{
- [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
- static class Foo_Entity_PrioritySortOrder
+ static partial class Foo_Entity
{
- private static readonly global::System.Reflection.PropertyInfo _p0 = typeof(global::Foo.Entity).GetProperty("Priority");
- private static readonly global::System.Reflection.MethodInfo _m0 = typeof(global::Foo.EnumExtensions).GetMethod("GetSortOrder", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(global::Foo.Priority) }, null);
-
// [Expressive]
// public int PrioritySortOrder => Priority.GetSortOrder();
- static global::System.Linq.Expressions.Expression> Expression()
+ static global::System.Linq.Expressions.Expression> PrioritySortOrder_Expression()
{
var p__this = global::System.Linq.Expressions.Expression.Parameter(typeof(global::Foo.Entity), "@this");
- var expr_0 = global::System.Linq.Expressions.Expression.Property(p__this, _p0); // Priority
+ var expr_0 = global::System.Linq.Expressions.Expression.Property(p__this, typeof(global::Foo.Entity).GetProperty("Priority")); // Priority
var expr_1 = global::System.Linq.Expressions.Expression.Default(typeof(int));
var expr_2 = global::System.Linq.Expressions.Expression.Constant(global::Foo.Priority.High, typeof(global::Foo.Priority));
- var expr_3 = global::System.Linq.Expressions.Expression.Call(_m0, new global::System.Linq.Expressions.Expression[] { expr_2 });
+ var expr_3 = global::System.Linq.Expressions.Expression.Call(typeof(global::Foo.EnumExtensions).GetMethod("GetSortOrder", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(global::Foo.Priority) }, null), new global::System.Linq.Expressions.Expression[] { expr_2 });
var expr_4 = global::System.Linq.Expressions.Expression.Equal(expr_0, expr_2);
var expr_5 = global::System.Linq.Expressions.Expression.Condition(expr_4, expr_3, expr_1, typeof(int));
var expr_6 = global::System.Linq.Expressions.Expression.Constant(global::Foo.Priority.Medium, typeof(global::Foo.Priority));
- var expr_7 = global::System.Linq.Expressions.Expression.Call(_m0, new global::System.Linq.Expressions.Expression[] { expr_6 });
+ var expr_7 = global::System.Linq.Expressions.Expression.Call(typeof(global::Foo.EnumExtensions).GetMethod("GetSortOrder", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(global::Foo.Priority) }, null), new global::System.Linq.Expressions.Expression[] { expr_6 });
var expr_8 = global::System.Linq.Expressions.Expression.Equal(expr_0, expr_6);
var expr_9 = global::System.Linq.Expressions.Expression.Condition(expr_8, expr_7, expr_5, typeof(int));
var expr_10 = global::System.Linq.Expressions.Expression.Constant(global::Foo.Priority.Low, typeof(global::Foo.Priority));
- var expr_11 = global::System.Linq.Expressions.Expression.Call(_m0, new global::System.Linq.Expressions.Expression[] { expr_10 });
+ var expr_11 = global::System.Linq.Expressions.Expression.Call(typeof(global::Foo.EnumExtensions).GetMethod("GetSortOrder", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(global::Foo.Priority) }, null), new global::System.Linq.Expressions.Expression[] { expr_10 });
var expr_12 = global::System.Linq.Expressions.Expression.Equal(expr_0, expr_10);
var expr_13 = global::System.Linq.Expressions.Expression.Condition(expr_12, expr_11, expr_9, typeof(int));
return global::System.Linq.Expressions.Expression.Lambda>(expr_13, p__this);
diff --git a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/EnumTests.ExpandEnumMethodsWithDescriptionAttribute.verified.txt b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/EnumTests.ExpandEnumMethodsWithDescriptionAttribute.verified.txt
index 94ea50e..4b7abf0 100644
--- a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/EnumTests.ExpandEnumMethodsWithDescriptionAttribute.verified.txt
+++ b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/EnumTests.ExpandEnumMethodsWithDescriptionAttribute.verified.txt
@@ -6,29 +6,25 @@ using Foo;
namespace ExpressiveSharp.Generated
{
- [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
- static class Foo_Entity_StatusDescription
+ static partial class Foo_Entity
{
- private static readonly global::System.Reflection.PropertyInfo _p0 = typeof(global::Foo.Entity).GetProperty("Status");
- private static readonly global::System.Reflection.MethodInfo _m0 = typeof(global::Foo.EnumExtensions).GetMethod("GetDescription", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(global::Foo.Status) }, null);
-
// [Expressive]
// public string StatusDescription => Status.GetDescription();
- static global::System.Linq.Expressions.Expression> Expression()
+ static global::System.Linq.Expressions.Expression> StatusDescription_Expression()
{
var p__this = global::System.Linq.Expressions.Expression.Parameter(typeof(global::Foo.Entity), "@this");
- var expr_0 = global::System.Linq.Expressions.Expression.Property(p__this, _p0); // Status
+ var expr_0 = global::System.Linq.Expressions.Expression.Property(p__this, typeof(global::Foo.Entity).GetProperty("Status")); // Status
var expr_1 = global::System.Linq.Expressions.Expression.Constant(null, typeof(string));
var expr_2 = global::System.Linq.Expressions.Expression.Constant(global::Foo.Status.Rejected, typeof(global::Foo.Status));
- var expr_3 = global::System.Linq.Expressions.Expression.Call(_m0, new global::System.Linq.Expressions.Expression[] { expr_2 });
+ var expr_3 = global::System.Linq.Expressions.Expression.Call(typeof(global::Foo.EnumExtensions).GetMethod("GetDescription", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(global::Foo.Status) }, null), new global::System.Linq.Expressions.Expression[] { expr_2 });
var expr_4 = global::System.Linq.Expressions.Expression.Equal(expr_0, expr_2);
var expr_5 = global::System.Linq.Expressions.Expression.Condition(expr_4, expr_3, expr_1, typeof(string));
var expr_6 = global::System.Linq.Expressions.Expression.Constant(global::Foo.Status.Approved, typeof(global::Foo.Status));
- var expr_7 = global::System.Linq.Expressions.Expression.Call(_m0, new global::System.Linq.Expressions.Expression[] { expr_6 });
+ var expr_7 = global::System.Linq.Expressions.Expression.Call(typeof(global::Foo.EnumExtensions).GetMethod("GetDescription", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(global::Foo.Status) }, null), new global::System.Linq.Expressions.Expression[] { expr_6 });
var expr_8 = global::System.Linq.Expressions.Expression.Equal(expr_0, expr_6);
var expr_9 = global::System.Linq.Expressions.Expression.Condition(expr_8, expr_7, expr_5, typeof(string));
var expr_10 = global::System.Linq.Expressions.Expression.Constant(global::Foo.Status.Pending, typeof(global::Foo.Status));
- var expr_11 = global::System.Linq.Expressions.Expression.Call(_m0, new global::System.Linq.Expressions.Expression[] { expr_10 });
+ var expr_11 = global::System.Linq.Expressions.Expression.Call(typeof(global::Foo.EnumExtensions).GetMethod("GetDescription", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(global::Foo.Status) }, null), new global::System.Linq.Expressions.Expression[] { expr_10 });
var expr_12 = global::System.Linq.Expressions.Expression.Equal(expr_0, expr_10);
var expr_13 = global::System.Linq.Expressions.Expression.Condition(expr_12, expr_11, expr_9, typeof(string));
return global::System.Linq.Expressions.Expression.Lambda>(expr_13, p__this);
diff --git a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/EnumTests.ExpandEnumMethodsWithDisplayAttribute.verified.txt b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/EnumTests.ExpandEnumMethodsWithDisplayAttribute.verified.txt
index 712fd16..11687e0 100644
--- a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/EnumTests.ExpandEnumMethodsWithDisplayAttribute.verified.txt
+++ b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/EnumTests.ExpandEnumMethodsWithDisplayAttribute.verified.txt
@@ -6,25 +6,21 @@ using Foo;
namespace ExpressiveSharp.Generated
{
- [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
- static class Foo_Entity_MyEnumName
+ static partial class Foo_Entity
{
- private static readonly global::System.Reflection.PropertyInfo _p0 = typeof(global::Foo.Entity).GetProperty("MyValue");
- private static readonly global::System.Reflection.MethodInfo _m0 = typeof(global::Foo.EnumExtensions).GetMethod("GetDisplayName", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(global::Foo.CustomEnum) }, null);
-
// [Expressive]
// public string MyEnumName => MyValue.GetDisplayName();
- static global::System.Linq.Expressions.Expression> Expression()
+ static global::System.Linq.Expressions.Expression> MyEnumName_Expression()
{
var p__this = global::System.Linq.Expressions.Expression.Parameter(typeof(global::Foo.Entity), "@this");
- var expr_0 = global::System.Linq.Expressions.Expression.Property(p__this, _p0); // MyValue
+ var expr_0 = global::System.Linq.Expressions.Expression.Property(p__this, typeof(global::Foo.Entity).GetProperty("MyValue")); // MyValue
var expr_1 = global::System.Linq.Expressions.Expression.Constant(null, typeof(string));
var expr_2 = global::System.Linq.Expressions.Expression.Constant(global::Foo.CustomEnum.Value2, typeof(global::Foo.CustomEnum));
- var expr_3 = global::System.Linq.Expressions.Expression.Call(_m0, new global::System.Linq.Expressions.Expression[] { expr_2 });
+ var expr_3 = global::System.Linq.Expressions.Expression.Call(typeof(global::Foo.EnumExtensions).GetMethod("GetDisplayName", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(global::Foo.CustomEnum) }, null), new global::System.Linq.Expressions.Expression[] { expr_2 });
var expr_4 = global::System.Linq.Expressions.Expression.Equal(expr_0, expr_2);
var expr_5 = global::System.Linq.Expressions.Expression.Condition(expr_4, expr_3, expr_1, typeof(string));
var expr_6 = global::System.Linq.Expressions.Expression.Constant(global::Foo.CustomEnum.Value1, typeof(global::Foo.CustomEnum));
- var expr_7 = global::System.Linq.Expressions.Expression.Call(_m0, new global::System.Linq.Expressions.Expression[] { expr_6 });
+ var expr_7 = global::System.Linq.Expressions.Expression.Call(typeof(global::Foo.EnumExtensions).GetMethod("GetDisplayName", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(global::Foo.CustomEnum) }, null), new global::System.Linq.Expressions.Expression[] { expr_6 });
var expr_8 = global::System.Linq.Expressions.Expression.Equal(expr_0, expr_6);
var expr_9 = global::System.Linq.Expressions.Expression.Condition(expr_8, expr_7, expr_5, typeof(string));
return global::System.Linq.Expressions.Expression.Lambda>(expr_9, p__this);
diff --git a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/EnumTests.ExpandEnumMethodsWithNullableEnum.verified.txt b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/EnumTests.ExpandEnumMethodsWithNullableEnum.verified.txt
index d753f7c..d8e1692 100644
--- a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/EnumTests.ExpandEnumMethodsWithNullableEnum.verified.txt
+++ b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/EnumTests.ExpandEnumMethodsWithNullableEnum.verified.txt
@@ -6,30 +6,24 @@ using Foo;
namespace ExpressiveSharp.Generated
{
- [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
- static class Foo_Entity_MyEnumName
+ static partial class Foo_Entity
{
- private static readonly global::System.Reflection.PropertyInfo _p0 = typeof(global::Foo.CustomEnum?).GetProperty("HasValue");
- private static readonly global::System.Reflection.PropertyInfo _p1 = typeof(global::Foo.Entity).GetProperty("MyValue");
- private static readonly global::System.Reflection.PropertyInfo _p2 = typeof(global::Foo.CustomEnum?).GetProperty("Value");
- private static readonly global::System.Reflection.MethodInfo _m0 = typeof(global::Foo.EnumExtensions).GetMethod("GetDisplayName", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(global::Foo.CustomEnum) }, null);
-
// [Expressive]
// public string MyEnumName => MyValue.HasValue ? MyValue.Value.GetDisplayName() : null;
- static global::System.Linq.Expressions.Expression> Expression()
+ static global::System.Linq.Expressions.Expression> MyEnumName_Expression()
{
var p__this = global::System.Linq.Expressions.Expression.Parameter(typeof(global::Foo.Entity), "@this");
- var expr_2 = global::System.Linq.Expressions.Expression.Property(p__this, _p1); // MyValue
- var expr_1 = global::System.Linq.Expressions.Expression.Property(expr_2, _p0);
- var expr_4 = global::System.Linq.Expressions.Expression.Property(p__this, _p1); // MyValue
- var expr_3 = global::System.Linq.Expressions.Expression.Property(expr_4, _p2);
+ var expr_2 = global::System.Linq.Expressions.Expression.Property(p__this, typeof(global::Foo.Entity).GetProperty("MyValue")); // MyValue
+ var expr_1 = global::System.Linq.Expressions.Expression.Property(expr_2, typeof(global::Foo.CustomEnum?).GetProperty("HasValue"));
+ var expr_4 = global::System.Linq.Expressions.Expression.Property(p__this, typeof(global::Foo.Entity).GetProperty("MyValue")); // MyValue
+ var expr_3 = global::System.Linq.Expressions.Expression.Property(expr_4, typeof(global::Foo.CustomEnum?).GetProperty("Value"));
var expr_5 = global::System.Linq.Expressions.Expression.Constant(null, typeof(string));
var expr_6 = global::System.Linq.Expressions.Expression.Constant(global::Foo.CustomEnum.Second, typeof(global::Foo.CustomEnum));
- var expr_7 = global::System.Linq.Expressions.Expression.Call(_m0, new global::System.Linq.Expressions.Expression[] { expr_6 });
+ var expr_7 = global::System.Linq.Expressions.Expression.Call(typeof(global::Foo.EnumExtensions).GetMethod("GetDisplayName", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(global::Foo.CustomEnum) }, null), new global::System.Linq.Expressions.Expression[] { expr_6 });
var expr_8 = global::System.Linq.Expressions.Expression.Equal(expr_3, expr_6);
var expr_9 = global::System.Linq.Expressions.Expression.Condition(expr_8, expr_7, expr_5, typeof(string));
var expr_10 = global::System.Linq.Expressions.Expression.Constant(global::Foo.CustomEnum.First, typeof(global::Foo.CustomEnum));
- var expr_11 = global::System.Linq.Expressions.Expression.Call(_m0, new global::System.Linq.Expressions.Expression[] { expr_10 });
+ var expr_11 = global::System.Linq.Expressions.Expression.Call(typeof(global::Foo.EnumExtensions).GetMethod("GetDisplayName", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(global::Foo.CustomEnum) }, null), new global::System.Linq.Expressions.Expression[] { expr_10 });
var expr_12 = global::System.Linq.Expressions.Expression.Equal(expr_3, expr_10);
var expr_13 = global::System.Linq.Expressions.Expression.Condition(expr_12, expr_11, expr_9, typeof(string));
var expr_15 = global::System.Linq.Expressions.Expression.Constant(null, typeof(object)); // null
diff --git a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/EnumTests.ExpandEnumMethodsWithParameter.verified.txt b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/EnumTests.ExpandEnumMethodsWithParameter.verified.txt
index eacfd8f..cbeca9e 100644
--- a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/EnumTests.ExpandEnumMethodsWithParameter.verified.txt
+++ b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/EnumTests.ExpandEnumMethodsWithParameter.verified.txt
@@ -5,32 +5,28 @@ using Foo;
namespace ExpressiveSharp.Generated
{
- [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
- static class Foo_Entity_StatusWithPrefix
+ static partial class Foo_Entity
{
- private static readonly global::System.Reflection.PropertyInfo _p0 = typeof(global::Foo.Entity).GetProperty("Status");
- private static readonly global::System.Reflection.MethodInfo _m0 = typeof(global::Foo.EnumExtensions).GetMethod("GetDisplayNameWithPrefix", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(global::Foo.Status), typeof(string) }, null);
-
// [Expressive]
// public string StatusWithPrefix => Status.GetDisplayNameWithPrefix("Status: ");
- static global::System.Linq.Expressions.Expression> Expression()
+ static global::System.Linq.Expressions.Expression> StatusWithPrefix_Expression()
{
var p__this = global::System.Linq.Expressions.Expression.Parameter(typeof(global::Foo.Entity), "@this");
- var expr_0 = global::System.Linq.Expressions.Expression.Property(p__this, _p0); // Status
+ var expr_0 = global::System.Linq.Expressions.Expression.Property(p__this, typeof(global::Foo.Entity).GetProperty("Status")); // Status
var expr_1 = global::System.Linq.Expressions.Expression.Constant(null, typeof(string));
var expr_2 = global::System.Linq.Expressions.Expression.Constant(global::Foo.Status.Rejected, typeof(global::Foo.Status));
var expr_3 = global::System.Linq.Expressions.Expression.Constant("Status: ", typeof(string)); // "Status: "
- var expr_4 = global::System.Linq.Expressions.Expression.Call(_m0, new global::System.Linq.Expressions.Expression[] { expr_2, expr_3 });
+ var expr_4 = global::System.Linq.Expressions.Expression.Call(typeof(global::Foo.EnumExtensions).GetMethod("GetDisplayNameWithPrefix", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(global::Foo.Status), typeof(string) }, null), new global::System.Linq.Expressions.Expression[] { expr_2, expr_3 });
var expr_5 = global::System.Linq.Expressions.Expression.Equal(expr_0, expr_2);
var expr_6 = global::System.Linq.Expressions.Expression.Condition(expr_5, expr_4, expr_1, typeof(string));
var expr_7 = global::System.Linq.Expressions.Expression.Constant(global::Foo.Status.Approved, typeof(global::Foo.Status));
var expr_8 = global::System.Linq.Expressions.Expression.Constant("Status: ", typeof(string)); // "Status: "
- var expr_9 = global::System.Linq.Expressions.Expression.Call(_m0, new global::System.Linq.Expressions.Expression[] { expr_7, expr_8 });
+ var expr_9 = global::System.Linq.Expressions.Expression.Call(typeof(global::Foo.EnumExtensions).GetMethod("GetDisplayNameWithPrefix", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(global::Foo.Status), typeof(string) }, null), new global::System.Linq.Expressions.Expression[] { expr_7, expr_8 });
var expr_10 = global::System.Linq.Expressions.Expression.Equal(expr_0, expr_7);
var expr_11 = global::System.Linq.Expressions.Expression.Condition(expr_10, expr_9, expr_6, typeof(string));
var expr_12 = global::System.Linq.Expressions.Expression.Constant(global::Foo.Status.Pending, typeof(global::Foo.Status));
var expr_13 = global::System.Linq.Expressions.Expression.Constant("Status: ", typeof(string)); // "Status: "
- var expr_14 = global::System.Linq.Expressions.Expression.Call(_m0, new global::System.Linq.Expressions.Expression[] { expr_12, expr_13 });
+ var expr_14 = global::System.Linq.Expressions.Expression.Call(typeof(global::Foo.EnumExtensions).GetMethod("GetDisplayNameWithPrefix", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(global::Foo.Status), typeof(string) }, null), new global::System.Linq.Expressions.Expression[] { expr_12, expr_13 });
var expr_15 = global::System.Linq.Expressions.Expression.Equal(expr_0, expr_12);
var expr_16 = global::System.Linq.Expressions.Expression.Condition(expr_15, expr_14, expr_11, typeof(string));
return global::System.Linq.Expressions.Expression.Lambda>(expr_16, p__this);
diff --git a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ExtensionMemberTests.ExtensionMemberMethod.verified.txt b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ExtensionMemberTests.ExtensionMemberMethod.verified.txt
index 54ecb3f..75f475e 100644
--- a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ExtensionMemberTests.ExtensionMemberMethod.verified.txt
+++ b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ExtensionMemberTests.ExtensionMemberMethod.verified.txt
@@ -5,18 +5,15 @@ using Foo;
namespace ExpressiveSharp.Generated
{
- [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
- static class Foo_EntityExtensions_TripleId_P0_Foo_Entity
+ static partial class Foo_EntityExtensions
{
- private static readonly global::System.Reflection.PropertyInfo _p0 = typeof(global::Foo.Entity).GetProperty("Id");
-
// [Expressive]
// public int TripleId() => e.Id * 3;
- static global::System.Linq.Expressions.Expression> Expression()
+ static global::System.Linq.Expressions.Expression> TripleId_P0_Foo_Entity_Expression()
{
var p__this = global::System.Linq.Expressions.Expression.Parameter(typeof(global::Foo.Entity), "@this");
var expr_2 = global::System.Linq.Expressions.Expression.Parameter(typeof(global::Foo.Entity), "e"); // e
- var expr_1 = global::System.Linq.Expressions.Expression.Property(expr_2, _p0);
+ var expr_1 = global::System.Linq.Expressions.Expression.Property(expr_2, typeof(global::Foo.Entity).GetProperty("Id"));
var expr_3 = global::System.Linq.Expressions.Expression.Constant(3, typeof(int)); // 3
var expr_0 = global::System.Linq.Expressions.Expression.MakeBinary(global::System.Linq.Expressions.ExpressionType.Multiply, expr_1, expr_3);
return global::System.Linq.Expressions.Expression.Lambda>(expr_0, p__this);
diff --git a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ExtensionMemberTests.ExtensionMemberMethodWithParameters.verified.txt b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ExtensionMemberTests.ExtensionMemberMethodWithParameters.verified.txt
index c022ca8..daa4bce 100644
--- a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ExtensionMemberTests.ExtensionMemberMethodWithParameters.verified.txt
+++ b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ExtensionMemberTests.ExtensionMemberMethodWithParameters.verified.txt
@@ -5,19 +5,16 @@ using Foo;
namespace ExpressiveSharp.Generated
{
- [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
- static class Foo_EntityExtensions_Multiply_P0_Foo_Entity_P1_int
+ static partial class Foo_EntityExtensions
{
- private static readonly global::System.Reflection.PropertyInfo _p0 = typeof(global::Foo.Entity).GetProperty("Id");
-
// [Expressive]
// public int Multiply(int factor) => e.Id * factor;
- static global::System.Linq.Expressions.Expression> Expression()
+ static global::System.Linq.Expressions.Expression> Multiply_P0_Foo_Entity_P1_int_Expression()
{
var p__this = global::System.Linq.Expressions.Expression.Parameter(typeof(global::Foo.Entity), "@this");
var p_factor = global::System.Linq.Expressions.Expression.Parameter(typeof(int), "factor");
var expr_2 = global::System.Linq.Expressions.Expression.Parameter(typeof(global::Foo.Entity), "e"); // e
- var expr_1 = global::System.Linq.Expressions.Expression.Property(expr_2, _p0);
+ var expr_1 = global::System.Linq.Expressions.Expression.Property(expr_2, typeof(global::Foo.Entity).GetProperty("Id"));
var expr_0 = global::System.Linq.Expressions.Expression.MakeBinary(global::System.Linq.Expressions.ExpressionType.Multiply, expr_1, p_factor);
return global::System.Linq.Expressions.Expression.Lambda>(expr_0, p__this, p_factor);
}
diff --git a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ExtensionMemberTests.ExtensionMemberOnInterface.verified.txt b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ExtensionMemberTests.ExtensionMemberOnInterface.verified.txt
index c7042ca..afd7940 100644
--- a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ExtensionMemberTests.ExtensionMemberOnInterface.verified.txt
+++ b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ExtensionMemberTests.ExtensionMemberOnInterface.verified.txt
@@ -5,26 +5,20 @@ using Foo;
namespace ExpressiveSharp.Generated
{
- [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
- static class Foo_IEntityExtensions_Label
+ static partial class Foo_IEntityExtensions
{
- private static readonly global::System.Reflection.PropertyInfo _p0 = typeof(global::Foo.IEntity).GetProperty("Id");
- private static readonly global::System.Reflection.MethodInfo _m0 = typeof(string).GetMethod("Concat", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(object), typeof(object) }, null);
- private static readonly global::System.Reflection.PropertyInfo _p1 = typeof(global::Foo.IEntity).GetProperty("Name");
- private static readonly global::System.Reflection.MethodInfo _m1 = typeof(string).GetMethod("Concat", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(string), typeof(string) }, null);
-
// [Expressive]
// public string Label => e.Id + ": " + e.Name;
- static global::System.Linq.Expressions.Expression> Expression()
+ static global::System.Linq.Expressions.Expression> Label_Expression()
{
var p__this = global::System.Linq.Expressions.Expression.Parameter(typeof(global::Foo.IEntity), "@this");
var expr_4 = global::System.Linq.Expressions.Expression.Parameter(typeof(global::Foo.IEntity), "e"); // e
- var expr_3 = global::System.Linq.Expressions.Expression.Property(expr_4, _p0);
+ var expr_3 = global::System.Linq.Expressions.Expression.Property(expr_4, typeof(global::Foo.IEntity).GetProperty("Id"));
var expr_2 = global::System.Linq.Expressions.Expression.Convert(expr_3, typeof(object));
var expr_5 = global::System.Linq.Expressions.Expression.Constant(": ", typeof(string)); // ": "
- var expr_1 = global::System.Linq.Expressions.Expression.Call(_m0, expr_2, expr_5);
- var expr_6 = global::System.Linq.Expressions.Expression.Property(expr_4, _p1); // e.Name
- var expr_0 = global::System.Linq.Expressions.Expression.Call(_m1, expr_1, expr_6);
+ var expr_1 = global::System.Linq.Expressions.Expression.Call(typeof(string).GetMethod("Concat", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(object), typeof(object) }, null), expr_2, expr_5);
+ var expr_6 = global::System.Linq.Expressions.Expression.Property(expr_4, typeof(global::Foo.IEntity).GetProperty("Name")); // e.Name
+ var expr_0 = global::System.Linq.Expressions.Expression.Call(typeof(string).GetMethod("Concat", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(string), typeof(string) }, null), expr_1, expr_6);
return global::System.Linq.Expressions.Expression.Lambda>(expr_0, p__this);
}
}
diff --git a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ExtensionMemberTests.ExtensionMemberOnPrimitive.verified.txt b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ExtensionMemberTests.ExtensionMemberOnPrimitive.verified.txt
index 4703566..3a38daf 100644
--- a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ExtensionMemberTests.ExtensionMemberOnPrimitive.verified.txt
+++ b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ExtensionMemberTests.ExtensionMemberOnPrimitive.verified.txt
@@ -4,12 +4,11 @@
namespace ExpressiveSharp.Generated
{
- [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
- static class _IntExtensions_Squared
+ static partial class _IntExtensions
{
// [Expressive]
// public int Squared => i * i;
- static global::System.Linq.Expressions.Expression> Expression()
+ static global::System.Linq.Expressions.Expression> Squared_Expression()
{
var p__this = global::System.Linq.Expressions.Expression.Parameter(typeof(int), "@this");
var expr_1 = global::System.Linq.Expressions.Expression.Parameter(typeof(int), "i"); // i
diff --git a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ExtensionMemberTests.ExtensionMemberProperty.verified.txt b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ExtensionMemberTests.ExtensionMemberProperty.verified.txt
index 2ffde67..3d8d0f0 100644
--- a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ExtensionMemberTests.ExtensionMemberProperty.verified.txt
+++ b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ExtensionMemberTests.ExtensionMemberProperty.verified.txt
@@ -5,18 +5,15 @@ using Foo;
namespace ExpressiveSharp.Generated
{
- [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
- static class Foo_EntityExtensions_DoubleId
+ static partial class Foo_EntityExtensions
{
- private static readonly global::System.Reflection.PropertyInfo _p0 = typeof(global::Foo.Entity).GetProperty("Id");
-
// [Expressive]
// public int DoubleId => e.Id * 2;
- static global::System.Linq.Expressions.Expression> Expression()
+ static global::System.Linq.Expressions.Expression> DoubleId_Expression()
{
var p__this = global::System.Linq.Expressions.Expression.Parameter(typeof(global::Foo.Entity), "@this");
var expr_2 = global::System.Linq.Expressions.Expression.Parameter(typeof(global::Foo.Entity), "e"); // e
- var expr_1 = global::System.Linq.Expressions.Expression.Property(expr_2, _p0);
+ var expr_1 = global::System.Linq.Expressions.Expression.Property(expr_2, typeof(global::Foo.Entity).GetProperty("Id"));
var expr_3 = global::System.Linq.Expressions.Expression.Constant(2, typeof(int)); // 2
var expr_0 = global::System.Linq.Expressions.Expression.MakeBinary(global::System.Linq.Expressions.ExpressionType.Multiply, expr_1, expr_3);
return global::System.Linq.Expressions.Expression.Lambda>(expr_0, p__this);
diff --git a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ExtensionMemberTests.ExtensionMemberWithBlockBody.verified.txt b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ExtensionMemberTests.ExtensionMemberWithBlockBody.verified.txt
index b6ecf1f..5350ff7 100644
--- a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ExtensionMemberTests.ExtensionMemberWithBlockBody.verified.txt
+++ b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ExtensionMemberTests.ExtensionMemberWithBlockBody.verified.txt
@@ -5,12 +5,8 @@ using Foo;
namespace ExpressiveSharp.Generated
{
- [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
- static class Foo_EntityExtensions_GetStatus_P0_Foo_Entity
+ static partial class Foo_EntityExtensions
{
- private static readonly global::System.Reflection.PropertyInfo _p0 = typeof(global::Foo.Entity).GetProperty("IsActive");
- private static readonly global::System.Reflection.PropertyInfo _p1 = typeof(global::Foo.Entity).GetProperty("Value");
-
// [Expressive(AllowBlockBody = true)]
// public string GetStatus()
// {
@@ -21,12 +17,12 @@ namespace ExpressiveSharp.Generated
//
// return "Inactive";
// }
- static global::System.Linq.Expressions.Expression> Expression()
+ static global::System.Linq.Expressions.Expression> GetStatus_P0_Foo_Entity_Expression()
{
var p__this = global::System.Linq.Expressions.Expression.Parameter(typeof(global::Foo.Entity), "@this");
var expr_3 = global::System.Linq.Expressions.Expression.Parameter(typeof(global::Foo.Entity), "e"); // e
- var expr_2 = global::System.Linq.Expressions.Expression.Property(expr_3, _p0);
- var expr_5 = global::System.Linq.Expressions.Expression.Property(expr_3, _p1); // e.Value
+ var expr_2 = global::System.Linq.Expressions.Expression.Property(expr_3, typeof(global::Foo.Entity).GetProperty("IsActive"));
+ var expr_5 = global::System.Linq.Expressions.Expression.Property(expr_3, typeof(global::Foo.Entity).GetProperty("Value")); // e.Value
var expr_6 = global::System.Linq.Expressions.Expression.Constant(0, typeof(int)); // 0
var expr_4 = global::System.Linq.Expressions.Expression.MakeBinary(global::System.Linq.Expressions.ExpressionType.GreaterThan, expr_5, expr_6);
var expr_1 = global::System.Linq.Expressions.Expression.MakeBinary(global::System.Linq.Expressions.ExpressionType.AndAlso, expr_2, expr_4);
diff --git a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ExtensionMemberTests.ExtensionMemberWithIsPatternExpression.verified.txt b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ExtensionMemberTests.ExtensionMemberWithIsPatternExpression.verified.txt
index 6f785de..699af39 100644
--- a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ExtensionMemberTests.ExtensionMemberWithIsPatternExpression.verified.txt
+++ b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ExtensionMemberTests.ExtensionMemberWithIsPatternExpression.verified.txt
@@ -5,18 +5,15 @@ using Foo;
namespace ExpressiveSharp.Generated
{
- [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
- static class Foo_EntityExtensions_IsHighValue
+ static partial class Foo_EntityExtensions
{
- private static readonly global::System.Reflection.PropertyInfo _p0 = typeof(global::Foo.Entity).GetProperty("Value");
-
// [Expressive]
// public bool IsHighValue => e.Value is> 100;
- static global::System.Linq.Expressions.Expression> Expression()
+ static global::System.Linq.Expressions.Expression> IsHighValue_Expression()
{
var p__this = global::System.Linq.Expressions.Expression.Parameter(typeof(global::Foo.Entity), "@this");
var expr_1 = global::System.Linq.Expressions.Expression.Parameter(typeof(global::Foo.Entity), "e"); // e
- var expr_0 = global::System.Linq.Expressions.Expression.Property(expr_1, _p0);
+ var expr_0 = global::System.Linq.Expressions.Expression.Property(expr_1, typeof(global::Foo.Entity).GetProperty("Value"));
var expr_3 = global::System.Linq.Expressions.Expression.Constant(100, typeof(int)); // 100
var expr_2 = global::System.Linq.Expressions.Expression.MakeBinary(global::System.Linq.Expressions.ExpressionType.GreaterThan, expr_0, expr_3);
return global::System.Linq.Expressions.Expression.Lambda>(expr_2, p__this);
diff --git a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ExtensionMemberTests.ExtensionMemberWithMemberAccess.verified.txt b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ExtensionMemberTests.ExtensionMemberWithMemberAccess.verified.txt
index a93de60..e594130 100644
--- a/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ExtensionMemberTests.ExtensionMemberWithMemberAccess.verified.txt
+++ b/tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/ExtensionMemberTests.ExtensionMemberWithMemberAccess.verified.txt
@@ -5,26 +5,20 @@ using Foo;
namespace ExpressiveSharp.Generated
{
- [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
- static class Foo_EntityExtensions_IdAndName
+ static partial class Foo_EntityExtensions
{
- private static readonly global::System.Reflection.PropertyInfo _p0 = typeof(global::Foo.Entity).GetProperty("Id");
- private static readonly global::System.Reflection.MethodInfo _m0 = typeof(string).GetMethod("Concat", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(object), typeof(object) }, null);
- private static readonly global::System.Reflection.PropertyInfo _p1 = typeof(global::Foo.Entity).GetProperty("Name");
- private static readonly global::System.Reflection.MethodInfo _m1 = typeof(string).GetMethod("Concat", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(string), typeof(string) }, null);
-
// [Expressive]
// public string IdAndName => e.Id + ": " + e.Name;
- static global::System.Linq.Expressions.Expression