diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-02-22 13:09:46 -0500 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-02-22 13:09:46 -0500 |
| commit | bfdb2da9e12775a0caa8de35f1d114181918529a (patch) | |
| tree | 4c371610df56b3730fac57591e10bc4ff2f48b25 /typecheck.c | |
| parent | 663182abdf0cb34c1b4331bfe29cefe14e053f73 (diff) | |
Implement power (^)
Diffstat (limited to 'typecheck.c')
| -rw-r--r-- | typecheck.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/typecheck.c b/typecheck.c index ad1062d1..30ac197d 100644 --- a/typecheck.c +++ b/typecheck.c @@ -457,6 +457,12 @@ type_t *get_type(env_t *env, ast_t *ast) code_err(ast, "I can't compare these two different types: %T vs %T", lhs_t, rhs_t); return Type(BoolType); } + case BINOP_POWER: { + type_t *result = get_math_type(env, ast, lhs_t, rhs_t); + if (result->tag == NumType) + return result; + return Type(NumType, .bits=64); + } default: { return get_math_type(env, ast, lhs_t, rhs_t); } |
