Skip to content

Commit

Permalink
minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
StunxFS committed Nov 16, 2023
1 parent 4e750af commit c1bb312
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
5 changes: 2 additions & 3 deletions cmd/src/tools/cmd_fmt.ri
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,18 @@ public func cmd_fmt(args: []string) -> ! {
}
for input in remaining {
mut prefs_ := prefs.Prefs(
input: input,
is_fmt: true,
hide_all_warns: true
);
prefs_.check_input(input);
prefs_.load_data()!;
prefs_.load_module_info()!;
report.reportTable.prefs = prefs_;
table_ := ast.Table.new(prefs_);
mut compiler := rivet.Compiler(table: table_, prefs: prefs_);
compiler.load_root_module()!;
mut formatter := fmt.Formatter(prefs_, table_, write_to_file: write_to_file);
for source_file in table_.source_files {
output := formatter.fmt(source_file);
output := formatter.format(source_file);
console.writeln(output);
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/rivet/src/fmt/mod.ri
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public struct Formatter {
mut line_len: uint;
mut empty_line: bool;

public func fmt(mut self, source_file: ast.SourceFile) -> string {
public func format(mut self, source_file: ast.SourceFile) -> string {
self.source_file = source_file;
self.format_decls(source_file.decls);
return self.output.to_string();
Expand Down
4 changes: 2 additions & 2 deletions lib/rivet/src/prefs/mod.ri
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ public struct Prefs {
if prefs.input.is_empty() {
utils.error("no input received");
}
prefs.load_data()!;
prefs.load_module_info()!;
return prefs;
}

Expand All @@ -301,7 +301,7 @@ public struct Prefs {
}
}

public func load_data(mut self) -> ! {
public func load_module_info(mut self) -> ! {
if self.is_test {
self.mod_output = "_rivet_tests_runner_";
} else if self.mod_output.is_empty() {
Expand Down

0 comments on commit c1bb312

Please sign in to comment.