aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/ek/ast.h10
-rw-r--r--include/ek/scope.h5
-rw-r--r--include/ek/vec.h3
3 files changed, 12 insertions, 6 deletions
diff --git a/include/ek/ast.h b/include/ek/ast.h
index 8f509cd..9c96832 100644
--- a/include/ek/ast.h
+++ b/include/ek/ast.h
@@ -594,9 +594,11 @@ static inline bool is_primitive(struct type *t)
#define gen_const_bool(i, loc)\
gen_ast(AST_CONST_BOOL, NULL, NULL, NULL, NULL, NULL, NULL, i, loc)
-#define init_body(x) return_a0(x, AST_ASSIGN)
-#define gen_init(body, loc)\
- gen1(AST_INIT, body, loc)
+#define init_args(x) return_t1(x, AST_INIT)
+#define init_body(x) return_a0(x, AST_INIT)
+#define init_id(x) return_s(x, AST_INIT)
+#define gen_init(id, targs, body, loc)\
+ gen_str_type1(AST_INIT, id, targs, body, loc)
#define assign_to(x) return_a0(x, AST_ASSIGN)
#define assign_from(x) return_a1(x, AST_ASSIGN)
@@ -612,7 +614,7 @@ static inline bool is_primitive(struct type *t)
/* types */
#define callable_ptypes(x) return_t0(x, TYPE_CALLABLE)
-#define callable_rtype(x) return_t0(x, TYPE_CALLABLE)
+#define callable_rtype(x) return_t1(x, TYPE_CALLABLE)
#define tgen_callable(ptypes, rtype, loc)\
tgen2(TYPE_CALLABLE, ptypes, rtype, loc)
diff --git a/include/ek/scope.h b/include/ek/scope.h
index 4858b55..5c9f9eb 100644
--- a/include/ek/scope.h
+++ b/include/ek/scope.h
@@ -88,8 +88,7 @@ struct scope {
*/
struct actual *actuals;
- struct visible *vars;
- struct visible *procs;
+ struct visible *symbols;
struct visible *macros;
struct visible *types;
@@ -261,6 +260,7 @@ int scope_resolve(struct scope *scope);
* otherwise \c NULL.
*/
struct ast *scope_find_var(struct scope *scope, char *id);
+struct ast *scope_find_symbol(struct scope *scope, char *id);
/**
* Find a type with ID in \p scope.
@@ -331,6 +331,7 @@ struct ast *scope_find_trait(struct scope *scope, char *id);
* otherwise \c NULL.
*/
struct ast *file_scope_find_var(struct scope *scope, char *id);
+struct ast *file_scope_find_symbol(struct scope *scope, char *id);
/**
* Find a type with ID visible to \p scope.
diff --git a/include/ek/vec.h b/include/ek/vec.h
index d9048fe..05155c8 100644
--- a/include/ek/vec.h
+++ b/include/ek/vec.h
@@ -20,6 +20,9 @@ void *vec_back(struct vec *v);
void *vec_pop(struct vec *v);
void vec_append(struct vec *v, void *n);
+typedef int (*vec_comp_t)(const void *, const void *);
+void vec_sort(struct vec *v, vec_comp_t comp);
+
#define foreach_vec(iter, v) \
for (size_t iter = 0, __n = vec_len(&v); iter < __n; ++iter)