Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: Fix default value when Stored #895

Merged
merged 13 commits into from
Feb 14, 2024
32 changes: 26 additions & 6 deletions src/Neo.Compiler.CSharp/MethodConvert/MethodConvert.cs
Original file line number Diff line number Diff line change
Expand Up @@ -574,14 +574,24 @@ private void ConvertStorageBackedProperty(IPropertySymbol property, AttributeDat
Call(ApplicationEngine.System_Storage_Get);
switch (property.Type.Name)
{
case "byte":
case "sbyte":
case "Byte":
case "SByte":
case "Short":

case "short":
case "ushort":
case "Int16":
case "Int32":
case "Int64":
case "UInt16":

case "int":
case "uint":
case "Int32":
case "UInt32":

case "long":
case "ulong":
case "Int64":
case "UInt64":
case "BigInteger":
// Replace NULL with 0
Expand Down Expand Up @@ -631,14 +641,24 @@ private void ConvertStorageBackedProperty(IPropertySymbol property, AttributeDat
AccessSlot(OpCode.LDARG, 1);
switch (property.Type.Name)
{
case "byte":
case "sbyte":
case "Byte":
case "SByte":
case "Short":

case "short":
case "ushort":
case "Int16":
case "Int32":
case "Int64":
case "UInt16":

case "int":
case "uint":
case "Int32":
case "UInt32":

case "long":
case "ulong":
case "Int64":
case "UInt64":
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not an issue here, but should we check the length of UInt160, UInt256 and ECPoint?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the unique way to set a different value in a property is because an storage collision (same prefix) and manual write to the same storage

case "BigInteger":
case "String":
Expand Down