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

C# does not generate correct code for constant presence enums #566

Closed
mjpt777 opened this issue Jun 21, 2018 · 0 comments
Closed

C# does not generate correct code for constant presence enums #566

mjpt777 opened this issue Jun 21, 2018 · 0 comments
Labels

Comments

@mjpt777
Copy link
Contributor

mjpt777 commented Jun 21, 2018

I noticed the C# generator does not handle constant presence enums. This was discovered to when trying to evaluate the impact of #560. @JPWatson, @ZachBray, @billsegall may be worth taking a look.

See the generated code for the discountedModel in the car example.

        public const int DiscountedModelId = 8;
        public const int DiscountedModelSinceVersion = 0;
        public const int DiscountedModelDeprecated = 0;
        public bool DiscountedModelInActingVersion()
        {
            return _actingVersion >= DiscountedModelSinceVersion;
        }

        public static string DiscountedModelMetaAttribute(MetaAttribute metaAttribute)
        {
            switch (metaAttribute)
            {
                case MetaAttribute.Epoch: return "";
                case MetaAttribute.TimeUnit: return "";
                case MetaAttribute.SemanticType: return "";
                case MetaAttribute.Presence: return "constant";
            }

            return "";
        }

        public Model DiscountedModel
        {
            get
            {
                return (Model)_buffer.CharGet(_offset + 39);
            }
            set
            {
                _buffer.CharPut(_offset + 39, (byte)value);
            }
        }
@mjpt777 mjpt777 added the bug label Jun 21, 2018
@mjpt777 mjpt777 closed this as completed Jul 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant