Skip to content

Commit 455f4e3

Browse files
committed
Format generated C files immediately after the templates task
1 parent 0815dd8 commit 455f4e3

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

Rakefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,9 @@ end
5252
# Task to format C code using clang-format
5353
namespace :format do
5454
dirs = ["src", "ext", "include"]
55-
excluded_files = ["ext/rbs_extension/lexer.c", "src/constants.c", "src/ruby_objs.c"]
5655

57-
# Find all C source and header files, then filter out excluded files
58-
files = `find #{dirs.join(" ")} -type f \\( -name "*.c" -o -name "*.h" \\)`.split("\n").reject do |file|
59-
excluded_files.include?(file)
60-
end
56+
# Find all C source and header files
57+
files = `find #{dirs.join(" ")} -type f \\( -name "*.c" -o -name "*.h" \\)`.split("\n")
6158

6259
desc "Format C source files using clang-format"
6360
task :c do
@@ -159,6 +156,9 @@ task :templates do
159156

160157
sh "#{ruby} templates/template.rb include/rbs/ast.h"
161158
sh "#{ruby} templates/template.rb src/ast.c"
159+
160+
# Format the generated files
161+
Rake::Task["format:c"].invoke
162162
end
163163

164164
task :compile => "ext/rbs_extension/class_constants.h"

ext/rbs_extension/ast_translation.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,6 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
134134
1,
135135
rb_hash_lookup(h, ID2SYM(rb_intern("type_params")))
136136
);
137-
138137
return CLASS_NEW_INSTANCE(
139138
RBS_AST_Declarations_Class,
140139
1,
@@ -220,7 +219,6 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
220219
1,
221220
rb_hash_lookup(h, ID2SYM(rb_intern("type_params")))
222221
);
223-
224222
return CLASS_NEW_INSTANCE(
225223
RBS_AST_Declarations_Interface,
226224
1,
@@ -245,7 +243,6 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
245243
1,
246244
rb_hash_lookup(h, ID2SYM(rb_intern("type_params")))
247245
);
248-
249246
return CLASS_NEW_INSTANCE(
250247
RBS_AST_Declarations_Module,
251248
1,
@@ -299,7 +296,6 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
299296
1,
300297
rb_hash_lookup(h, ID2SYM(rb_intern("type_params")))
301298
);
302-
303299
return CLASS_NEW_INSTANCE(
304300
RBS_AST_Declarations_TypeAlias,
305301
1,
@@ -691,7 +687,6 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
691687
1,
692688
rb_hash_lookup(h, ID2SYM(rb_intern("type_params")))
693689
);
694-
695690
return CLASS_NEW_INSTANCE(
696691
RBS_MethodType,
697692
1,

0 commit comments

Comments
 (0)