Skip to content

Commit 3ab2aea

Browse files
committed
Include self
1 parent 3f15ceb commit 3ab2aea

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/DynamoDBGenerator.SourceGenerator/Generations/AttributeExpressionName.cs

+4-3
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ internal static IEnumerable<string> CreateClasses(IEnumerable<DynamoDBMarshaller
2222
}
2323
private static IEnumerable<string> TypeContent(
2424
ITypeSymbol typeSymbol,
25-
(bool IsUnknown, DynamoDbDataMember DDB, string NameRef, string AttributeReference, string AttributeInterfaceName)[] dataMembers,
25+
(bool IsUnknown, DynamoDbDataMember DDB, string DbRef, string NameRef, string AttributeReference, string AttributeInterfaceName)[] dataMembers,
2626
string structName)
2727
{
2828
const string self = "_self";
@@ -57,8 +57,8 @@ private static IEnumerable<string> TypeContent(
5757

5858
var yields = dataMembers
5959
.Select(static x => x.IsUnknown
60-
? $"if ({x.NameRef}.IsValueCreated) foreach (var x in ({x.DDB.DataMember.Name} as {x.AttributeInterfaceName}).{AttributeExpressionNameTrackerInterfaceAccessedNames}()) {{ yield return x; }}"
61-
: $@"if ({x.NameRef}.IsValueCreated) yield return new ({x.NameRef}.Value, ""{x.DDB.AttributeName}"");"
60+
? $@"if ({x.NameRef}.IsValueCreated) {{ yield return new (""#{x.DbRef}"", ""{x.DDB.AttributeName}""); foreach (var x in ({x.DDB.DataMember.Name} as {x.AttributeInterfaceName}).{AttributeExpressionNameTrackerInterfaceAccessedNames}()) {{ yield return x; }} }}"
61+
: $@"if ({x.NameRef}.IsValueCreated) yield return new (""#{x.DbRef}"", ""{x.DDB.AttributeName}"");"
6262
)
6363
.Append($@"if ({self}.IsValueCreated) yield return new ({self}.Value, ""{typeSymbol.Name}"");");
6464

@@ -73,6 +73,7 @@ private static CodeFactory CreateStruct(ITypeSymbol typeSymbol, Func<ITypeSymbol
7373
.Select(x => (
7474
IsUnknown: !options.IsConvertable(x.DataMember.Type) && x.DataMember.Type.TypeIdentifier() is UnknownType,
7575
DDB: x,
76+
DbRef: $"#{x.AttributeName}",
7677
NameRef: $"_{x.DataMember.Name}NameRef",
7778
AttributeReference: TypeName(x.DataMember.Type),
7879
AttributeInterfaceName: AttributeExpressionNameTrackerInterface

0 commit comments

Comments
 (0)