mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Fix constant typeid comparisons. Allow methods to use & and * and constants. Improved error messages. Updated String type with generic append.
This commit is contained in:
committed by
Christoffer Lerno
parent
c1de3f059e
commit
7e0a29ef40
@@ -102,7 +102,8 @@ bool expr_const_compare(const ExprConst *left, const ExprConst *right, BinaryOp
|
||||
is_eq = !strncmp(left->string.chars, right->string.chars, left->string.len);
|
||||
break;
|
||||
case CONST_TYPEID:
|
||||
return left->typeid == right->typeid;
|
||||
is_eq = left->typeid == right->typeid;
|
||||
break;
|
||||
case CONST_ERR:
|
||||
case CONST_ENUM:
|
||||
{
|
||||
@@ -151,6 +152,15 @@ bool expr_const_compare(const ExprConst *left, const ExprConst *right, BinaryOp
|
||||
return (op == BINARYOP_EQ) && is_eq;
|
||||
}
|
||||
|
||||
bool expr_const_in_range(const ExprConst *left, const ExprConst *right, const ExprConst *right_to)
|
||||
{
|
||||
if (right == right_to)
|
||||
{
|
||||
return expr_const_compare(left, right, BINARYOP_EQ);
|
||||
}
|
||||
return expr_const_compare(left, right, BINARYOP_GE) && expr_const_compare(left, right_to, BINARYOP_LE);
|
||||
}
|
||||
|
||||
bool float_const_fits_type(const ExprConst *expr_const, TypeKind kind)
|
||||
{
|
||||
Real hi_limit;
|
||||
|
||||
Reference in New Issue
Block a user