本文整理匯總了C#中AST.PushEnum方法的典型用法代碼示例。如果您正苦於以下問題:C# AST.PushEnum方法的具體用法?C# AST.PushEnum怎麽用?C# AST.PushEnum使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類AST
的用法示例。
在下文中一共展示了AST.PushEnum方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: GetExprTypeEnv
public override Tuple<AST.Env, AST.ExprType> GetExprTypeEnv(AST.Env env, Boolean is_const, Boolean is_volatile) {
if (enums == null) {
// if there is no content in this enum type, we must find it's definition in the environment
Option<AST.Env.Entry> entry_opt = env.Find($"enum {name}");
if (entry_opt.IsNone || entry_opt.Value.kind != AST.Env.EntryKind.TYPEDEF) {
throw new InvalidOperationException($"Type 'enum {name}' has not been defined.");
}
} else {
// so there are something in this enum type, we need to put this type into the environment
Int32 idx = 0;
foreach (Enumerator elem in enums) {
Tuple<AST.Env, String, Int32> r_enum = elem.GetEnumerator(env, idx);
env = r_enum.Item1;
String name = r_enum.Item2;
idx = r_enum.Item3;
env = env.PushEnum(name, new AST.TLong(), idx);
idx++;
}
env = env.PushEntry(AST.Env.EntryKind.TYPEDEF, "enum " + name, new AST.TLong());
}
return new Tuple<AST.Env, AST.ExprType>(env, new AST.TLong(is_const, is_volatile));
}