private void HandleUseType(AstUsingStmt use) { switch (use.Value.Value as CheezType) { case EnumType e: { var decl = e.Declaration; ComputeEnumMembers(decl); foreach (var m in decl.Members) { var eve = new AstEnumValueExpr(e.Declaration, m); use.Scope.DefineUse(m.Name, eve, true, out var u); } break; } case GenericEnumType e: { var decl = e.Declaration; ComputeEnumMembers(decl); foreach (var m in decl.Members) { var eve = new AstEnumValueExpr(decl, m); use.Scope.DefineUse(m.Name, eve, true, out var u); } break; } default: ReportError(use, $"Can't use type '{use.Value.Value}'"); break; } }
public override string VisitEnumValueExpr(AstEnumValueExpr expr, int data = 0) { if (expr.Argument != null) { return($"{expr.Type}.{expr.Member.Name}({expr.Argument.Accept(this)})"); } return($"{expr.Type}.{expr.Member.Name}"); }
public virtual ReturnType VisitEnumValueExpr(AstEnumValueExpr expr, DataType data = default) => default;