From 9f034b4ebfe15844ea610ec2dd2fca1a9f7ce338 Mon Sep 17 00:00:00 2001 From: Carlos Maniero Date: Sat, 29 Apr 2023 15:55:39 -0300 Subject: ast: Introduce ast_identifier_t for named ast nodes Prior to this change, ast_variable_declaration_t and ast_function_declaration_t used a string_view as an identifier. However, to support scoped identifiers, it is more appropriate to use an ast_identifier_t as a reference. Signed-off-by: Carlos Maniero Co-authored-by: Johnny Richard --- test/parser_test.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'test/parser_test.c') diff --git a/test/parser_test.c b/test/parser_test.c index 251054d..40c0198 100644 --- a/test/parser_test.c +++ b/test/parser_test.c @@ -71,7 +71,7 @@ test_parse_function(const MunitParameter params[], void *user_data_or_fixture) char actual[5]; - string_view_to_str(&ast_function->data.function.name, actual); + string_view_to_str(&ast_function->data.function.identifier.name, actual); assert_string_equal("main", actual); assert_int(AST_FUNCTION_DECLARATION, ==, ast_function->kind); @@ -105,14 +105,14 @@ test_parse_variable_definition(const MunitParameter params[], void *user_data_or char actual[5]; - string_view_to_str(&ast_function->data.function.name, actual); + string_view_to_str(&ast_function->data.function.identifier.name, actual); assert_string_equal("main", actual); assert_int(AST_FUNCTION_DECLARATION, ==, ast_function->kind); ast_node_t *ast_variable = vector_at(ast_function->data.function.body, 0); assert_int(AST_VARIABLE_DECLARATION, ==, ast_variable->kind); - assert_string_view_equal("variable", ast_variable->data.variable.name); + assert_string_view_equal("variable", ast_variable->data.variable.identifier.name); ast_node_t *ast_return = vector_at(ast_function->data.function.body, 1); -- cgit v1.2.3