code / tomo

Lines41.3K C23.7K Markdown9.7K YAML5.0K Tomo2.3K
7 others 763
Python231 Shell230 make212 INI47 Text21 SVG16 Lua6
(38 lines)
1 #pragma once
3 // Type-checking functions
5 #include <gc.h>
6 #include <stdarg.h>
7 #include <stdbool.h>
9 #include "ast.h"
10 #include "environment.h"
11 #include "types.h"
13 type_t *parse_type_ast(env_t *env, type_ast_t *ast);
14 type_t *get_type(env_t *env, ast_t *ast);
15 void prebind_statement(env_t *env, ast_t *statement);
16 void bind_statement(env_t *env, ast_t *statement);
17 PUREFUNC type_t *get_math_type(env_t *env, ast_t *ast, type_t *lhs_t, type_t *rhs_t);
18 PUREFUNC bool is_discardable(env_t *env, ast_t *ast);
19 type_t *get_function_type(env_t *env, ast_t *ast);
20 type_t *get_function_return_type(env_t *env, ast_t *ast);
21 type_t *get_arg_type(env_t *env, arg_t *arg);
22 type_t *get_arg_ast_type(env_t *env, arg_ast_t *arg);
23 env_t *when_clause_scope(env_t *env, type_t *subject_t, when_clause_t *clause);
24 type_t *get_clause_type(env_t *env, type_t *subject_t, when_clause_t *clause);
25 PUREFUNC bool can_be_mutated(env_t *env, ast_t *ast);
26 type_t *parse_type_string(env_t *env, const char *str);
27 type_t *get_method_type(env_t *env, ast_t *self, const char *name);
28 PUREFUNC bool is_constant(env_t *env, ast_t *ast);
29 PUREFUNC bool can_compile_to_type(env_t *env, ast_t *ast, type_t *needed);
30 OptionalText_t suggest_best_name(const char *wrong, List_t names);
31 List_t get_field_names(env_t *env, type_t *t);
32 List_t get_method_names(env_t *env, type_t *t);
34 typedef struct {
35 bool promotion : 1, underscores : 1;
36 } call_opts_t;
38 bool is_valid_call(env_t *env, arg_t *spec_args, arg_ast_t *call_args, call_opts_t options);