EnumContext
using CLanguage.Syntax;
using CLanguage.Types;
using System.Linq;
using System.Runtime.CompilerServices;
namespace CLanguage.Compiler
{
[System.Runtime.CompilerServices.NullableContext(1)]
[System.Runtime.CompilerServices.Nullable(0)]
public class EnumContext : EmitContext
{
private TypeSpecifier enumTs;
private CEnumType et;
private EmitContext emitContext;
public EnumContext(TypeSpecifier enumTs, CEnumType et, EmitContext parentContext)
: base(parentContext)
{
this.enumTs = enumTs;
this.et = et;
emitContext = parentContext;
}
[return: System.Runtime.CompilerServices.Nullable(2)]
public override ResolvedVariable TryResolveVariable(string name, [System.Runtime.CompilerServices.Nullable(new byte[] {
2,
1
})] CType[] argTypes)
{
CEnumMember cEnumMember = et.Members.FirstOrDefault((CEnumMember x) => x.Name == name);
if (cEnumMember != null)
return new ResolvedVariable(cEnumMember.Value, et);
return base.TryResolveVariable(name, argTypes);
}
}
}