KingslandConsulting / Kingsland.MofParser

A C# library for parsing the contents of Managed Object Format (MOF) files
GNU Lesser General Public License v3.0
25 stars 4 forks source link

MofGenerator doesn't work for enum values #38

Closed mikeclayton closed 5 years ago

mikeclayton commented 5 years ago

When trying to parse and serialize the following MOF text:

class GOLF_Professional : GOLF_ClubMember
{
    GOLF_ResultCodeEnum GetNumberOfProfessionals (
        Integer NoOfPros,
        GOLF_Club Club,
        ProfessionalStatusEnum Status = Professional
    );
};

the following exception is raised from MofGenerator.

Message: System.InvalidOperationException : Kingsland.MofParser.Ast.EnumValueAst

when trying to serialize the "Status" property.

There are two issues:

source.Append(MofGenerator.ConvertPropertyValueAst(node.DefaultValue, quirks));

instead of

source.Append(MofGenerator.ConvertMof(node.DefaultValue, quirks));