mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Support partial const enums despite use-old-enums enabled.
This commit is contained in:
@@ -2592,11 +2592,6 @@ static inline Decl *parse_enum_declaration(ParseContext *c)
|
|||||||
if (try_consume(c, TOKEN_COLON))
|
if (try_consume(c, TOKEN_COLON))
|
||||||
{
|
{
|
||||||
is_const_enum = try_consume(c, TOKEN_CONST);
|
is_const_enum = try_consume(c, TOKEN_CONST);
|
||||||
if (is_const_enum && compiler.build.old_enums)
|
|
||||||
{
|
|
||||||
PRINT_ERROR_LAST("'const' enums are not available with '--use-old-enums'.");
|
|
||||||
return poisoned_decl;
|
|
||||||
}
|
|
||||||
if (!tok_is(c, TOKEN_LPAREN) && !tok_is(c, TOKEN_LBRACE))
|
if (!tok_is(c, TOKEN_LPAREN) && !tok_is(c, TOKEN_LBRACE))
|
||||||
{
|
{
|
||||||
val_is_inline = try_consume(c, TOKEN_INLINE);
|
val_is_inline = try_consume(c, TOKEN_INLINE);
|
||||||
|
|||||||
@@ -1539,7 +1539,6 @@ static bool rule_enum_to_value(CastContext *cc, bool is_explicit, bool is_silent
|
|||||||
{
|
{
|
||||||
if (!enum_decl->is_substruct)
|
if (!enum_decl->is_substruct)
|
||||||
{
|
{
|
||||||
|
|
||||||
return sema_cast_error(cc, false, is_silent);
|
return sema_cast_error(cc, false, is_silent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5704,7 +5704,7 @@ static bool sema_expr_rewrite_to_type_property(SemaContext *context, Expr *expr,
|
|||||||
.property = property };
|
.property = property };
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
goto TYPE_CALL;;
|
goto TYPE_CALL;
|
||||||
case TYPE_PROPERTY_LOOKUP:
|
case TYPE_PROPERTY_LOOKUP:
|
||||||
if (!compiler.build.old_enums)
|
if (!compiler.build.old_enums)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user