Skip to content

Commit bb63157

Browse files
committed
Renames
1 parent 40f826c commit bb63157

File tree

4 files changed

+18
-18
lines changed

4 files changed

+18
-18
lines changed

include/tea_scope.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
#include "tea_value.h"
55

66
typedef struct {
7-
const char *fname;
8-
tea_list_entry_t fns;
9-
tea_list_entry_t nfns;
7+
const char *file_name;
8+
tea_list_entry_t funcs;
9+
tea_list_entry_t native_funcs;
1010
tea_list_entry_t structs;
1111
tea_list_entry_t vars;
1212
} tea_ctx_t;

src/tea_fn.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ bool tea_decl_fn(const tea_node_t *node, tea_list_entry_t *functions)
121121

122122
bool tea_interp_fn_decl(tea_ctx_t *ctx, const tea_node_t *node)
123123
{
124-
return tea_decl_fn(node, &ctx->fns);
124+
return tea_decl_fn(node, &ctx->funcs);
125125
}
126126

127127
tea_val_t tea_eval_native_fn_call(tea_ctx_t *ctx, tea_scope_t *scp,
@@ -269,21 +269,20 @@ tea_val_t tea_eval_fn_call(tea_ctx_t *ctx, tea_scope_t *scp,
269269

270270
if (function) {
271271
// declare 'self' for the scope
272-
tea_decl_var(ctx, &inner_scope, "self",
273-
function->mut ? TEA_VAR_MUT : 0,
274-
NULL, object_node);
272+
tea_decl_var(ctx, &inner_scope, "self", function->mut ? TEA_VAR_MUT : 0,
273+
NULL, object_node);
275274
}
276275
} else {
277276
const tea_tok_t *token = node->tok;
278277
if (token) {
279278
const tea_native_fn_t *nat_fn =
280-
tea_ctx_find_native_fn(&ctx->nfns, token->buf);
279+
tea_ctx_find_native_fn(&ctx->native_funcs, token->buf);
281280
if (nat_fn) {
282281
return tea_eval_native_fn_call(ctx, scp, nat_fn, args);
283282
}
284283

285284
function_name = token->buf;
286-
function = tea_ctx_find_fn(&ctx->fns, token->buf);
285+
function = tea_ctx_find_fn(&ctx->funcs, token->buf);
287286
}
288287
}
289288

@@ -394,6 +393,6 @@ void tea_bind_native_fn(tea_ctx_t *ctx, const char *name,
394393
if (function) {
395394
function->name = name;
396395
function->cb = cb;
397-
tea_list_add_tail(&ctx->nfns, &function->link);
396+
tea_list_add_tail(&ctx->native_funcs, &function->link);
398397
}
399398
}

src/tea_interp.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88

99
void tea_interp_init(tea_ctx_t *ctx, const char *fname)
1010
{
11-
ctx->fname = fname;
12-
tea_list_init(&ctx->fns);
13-
tea_list_init(&ctx->nfns);
11+
ctx->file_name = fname;
12+
tea_list_init(&ctx->funcs);
13+
tea_list_init(&ctx->native_funcs);
1414
tea_list_init(&ctx->structs);
1515

1616
tea_list_init(&ctx->vars);
@@ -21,14 +21,14 @@ void tea_interp_cleanup(const tea_ctx_t *ctx)
2121
tea_list_entry_t *entry;
2222
tea_list_entry_t *safe;
2323

24-
tea_list_for_each_safe(entry, safe, &ctx->fns)
24+
tea_list_for_each_safe(entry, safe, &ctx->funcs)
2525
{
2626
tea_fn_t *function = tea_list_record(entry, tea_fn_t, link);
2727
tea_list_remove(entry);
2828
tea_free(function);
2929
}
3030

31-
tea_list_for_each_safe(entry, safe, &ctx->nfns)
31+
tea_list_for_each_safe(entry, safe, &ctx->native_funcs)
3232
{
3333
tea_native_fn_t *function = tea_list_record(entry, tea_native_fn_t, link);
3434
tea_list_remove(entry);

src/tea_stmt.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -416,12 +416,13 @@ bool tea_exec(tea_ctx_t *ctx, tea_scope_t *scp, const tea_node_t *node,
416416
tea_log_err(
417417
"Interpreter error: Unimplemented statement type <%s> in file %s, token: <%s> '%.*s' "
418418
"(line %d, col %d)",
419-
tea_node_type_name(node->type), ctx->fname, tea_tok_name(token->type),
420-
token->size, token->buf, token->line, token->col);
419+
tea_node_type_name(node->type), ctx->file_name,
420+
tea_tok_name(token->type), token->size, token->buf, token->line,
421+
token->col);
421422
} else {
422423
tea_log_err(
423424
"Interpreter error: Unimplemented statement type <%s> in file %s",
424-
tea_node_type_name(node->type), ctx->fname);
425+
tea_node_type_name(node->type), ctx->file_name);
425426
}
426427
} break;
427428
}

0 commit comments

Comments
 (0)