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

Added CreateStruct & Fixed CreateMap #3494

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

cschuchardt88
Copy link
Member

@cschuchardt88 cschuchardt88 commented Sep 20, 2024

Description

  • Added CreateStruct method
  • CreateMap changed to initialize items on the stack to be packed as a new map. Changed to follow CreateArray and CreateStruct.
  • Type case removed because in C# char already is a ushort.

Type of change

  • Optimization (the change is only an optimization)
  • Style (the change is only a code style for better maintenance or standard purpose)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

  • Unit tests

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@Jim8y
Copy link
Contributor

Jim8y commented Sep 20, 2024

can you add a little bit more explanation on this pr.

@roman-khimov
Copy link
Contributor

Changes are nice, but I don't like the way they're stuffed into a single commit without any real comments (more efficient packer is not a "fix", additional method is an additional method, type cast is a separate matter as well).

@cschuchardt88
Copy link
Member Author

I updated the description in the 1st comment.

public static ScriptBuilder CreateMap<TKey, TValue>(this ScriptBuilder builder, IEnumerable<KeyValuePair<TKey, TValue>> map = null)
public static ScriptBuilder CreateMap<TKey, TValue>(this ScriptBuilder builder, IEnumerable<KeyValuePair<TKey, TValue>> map)
where TKey : notnull
where TValue : notnull
Copy link
Contributor

@Jim8y Jim8y Sep 21, 2024

Choose a reason for hiding this comment

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

Value can not be null? Do we have this limitation before?

Copy link
Member Author

@cschuchardt88 cschuchardt88 Sep 21, 2024

Choose a reason for hiding this comment

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

You can't do map[null] = null. You could before but wouldn't work. Needs to be StackItem.Null.

This just stop you from using value types from being null like byte?, int? and etc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants