aboutsummaryrefslogtreecommitdiff
path: root/src/check.c
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2024-06-25 23:25:29 +0300
committerKimplul <kimi.h.kuparinen@gmail.com>2024-06-25 23:25:29 +0300
commit01052811be08444458576dda994d15f8823560ea (patch)
treec52f2d72ef0ef703e755fcf05ee5d3a02f050acc /src/check.c
parent449ca1e570aa421992bbe98c6928def1ba8896fd (diff)
downloadposthaste-01052811be08444458576dda994d15f8823560ea.tar.gz
posthaste-01052811be08444458576dda994d15f8823560ea.zip
initial rewrite to use ejit
+ Doesn't actually link yet due to missing stuff from ejit, will have to add them (tomorrow?)
Diffstat (limited to 'src/check.c')
-rw-r--r--src/check.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/src/check.c b/src/check.c
index 0858c67..e6dc81e 100644
--- a/src/check.c
+++ b/src/check.c
@@ -58,7 +58,8 @@ static int analyze_list(struct state *state, struct scope *scope, struct ast *l)
return 0;
}
-static int analyze_statement_list(struct state *state, struct scope *scope, struct ast *l)
+static int analyze_statement_list(struct state *state, struct scope *scope,
+ struct ast *l)
{
foreach_node(n, l) {
if (analyze(state, scope, n))
@@ -69,7 +70,7 @@ static int analyze_statement_list(struct state *state, struct scope *scope, stru
if (n->t != TYPE_VOID) {
semantic_error(scope, n,
- "non-void proc call not allowed as statement");
+ "non-void proc call not allowed as statement");
return -1;
}
}
@@ -177,7 +178,8 @@ static int analyze_proc_def(struct state *state, struct scope *scope,
* return, but for simplicity require user to add explicit return as
* last statement in body */
if (p->t != TYPE_VOID && last->k != AST_RETURN) {
- semantic_error(scope, p, "can't prove that proc reaches return statement");
+ semantic_error(scope, p,
+ "can't prove that proc reaches return statement");
return -1;
}
@@ -200,8 +202,9 @@ static int analyze_var_def(struct state *state, struct scope *scope,
return -1;
if (!concrete_type(expr->t)) {
- semantic_error(scope, n, "illegal type in variable definition: %s",
- type_str(expr->t));
+ semantic_error(scope, n,
+ "illegal type in variable definition: %s",
+ type_str(expr->t));
return -1;
}
@@ -217,8 +220,9 @@ static int analyze_formal_def(struct state *state, struct scope *scope,
return -1;
if (!concrete_type(n->t)) {
- semantic_error(scope, n, "illegal type for formal parameter: %s",
- type_str(n->t));
+ semantic_error(scope, n,
+ "illegal type for formal parameter: %s",
+ type_str(n->t));
return -1;
}
@@ -592,7 +596,7 @@ static int analyze_assign(struct state *state, struct scope *scope,
if (!concrete_type(l->t)) {
semantic_error(scope, n, "illegal type for lefthand side: %s",
- type_str(l->t));
+ type_str(l->t));
return -1;
}
@@ -602,7 +606,7 @@ static int analyze_assign(struct state *state, struct scope *scope,
if (!concrete_type(r->t)) {
semantic_error(scope, n, "illegal type for righthand side: %s",
- type_str(r->t));
+ type_str(r->t));
return -1;
}
@@ -762,7 +766,8 @@ static int analyze_unless(struct state *state, struct scope *scope,
}
struct ast *otherwise = unless_otherwise(n);
- if (otherwise && analyze_statement_list(state, otherwise_scope, otherwise))
+ if (otherwise && analyze_statement_list(state, otherwise_scope,
+ otherwise))
return -1;
n->t = TYPE_VOID;
@@ -849,8 +854,8 @@ static int analyze(struct state *state, struct scope *scope, struct ast *n)
case AST_UNLESS: ret = analyze_unless(state, scope, n); break;
case AST_UNLESS_EXPR: ret = analyze_unless_expr(state, scope, n); break;
default: break;
- /* not all nodes are in this switch statement, as the internal
- * ones are assumed to be correct */
+ /* not all nodes are in this switch statement, as the internal
+ * ones are assumed to be correct */
}
if (ret == 0) {