Skip to content

Commit

Permalink
Do not use Output's var_occurrences for type functions
Browse files Browse the repository at this point in the history
  • Loading branch information
sasial-dev committed Jan 26, 2025
1 parent b9d5480 commit dd09d10
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions zap/src/output/luau/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ impl<'src> ClientOutput<'src> {
&[ty.clone()],
&["value".to_string()],
self.config.write_checks,
&mut self.var_occurrences,
&mut HashMap::new(),
);
self.push_stmts(statements);
self.dedent();
Expand All @@ -124,7 +124,7 @@ impl<'src> ClientOutput<'src> {
self.push_line(&format!("function types.read_{name}()"));
self.indent();
self.push_line("local value;");
let statements = &des::gen(&[ty.clone()], &["value".to_string()], false, &mut self.var_occurrences);
let statements = &des::gen(&[ty.clone()], &["value".to_string()], false, &mut HashMap::new());
self.push_stmts(statements);
self.push_line("return value");
self.dedent();
Expand Down
4 changes: 2 additions & 2 deletions zap/src/output/luau/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ impl<'a> ServerOutput<'a> {
&[ty.clone()],
&["value".to_string()],
self.config.write_checks,
&mut self.var_occurrences,
&mut HashMap::new(),
);
self.push_stmts(statements);
self.dedent();
Expand All @@ -133,7 +133,7 @@ impl<'a> ServerOutput<'a> {
self.push_line(&format!("function types.read_{name}()"));
self.indent();
self.push_line("local value;");
let statements = &des::gen(&[ty.clone()], &["value".to_string()], true, &mut self.var_occurrences);
let statements = &des::gen(&[ty.clone()], &["value".to_string()], true, &mut HashMap::new());
self.push_stmts(statements);
self.push_line("return value");
self.dedent();
Expand Down
2 changes: 1 addition & 1 deletion zap/src/output/tooling.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ impl<'src> ToolingOutput<'src> {
std::iter::once(ty),
&get_unnamed_values("value", 1),
true,
&mut self.var_occurrences,
&mut HashMap::new(),
);
self.push_stmts(statements);
self.push_line("return value");
Expand Down
4 changes: 2 additions & 2 deletions zap/tests/irgen/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ impl<'src> TestOutput<'src> {
&[ty.clone()],
&["value".to_string()],
self.config.write_checks,
&mut self.var_occurrences,
&mut HashMap::new(),
);
self.push_stmts(statements);
self.dedent();
Expand All @@ -71,7 +71,7 @@ impl<'src> TestOutput<'src> {
self.push_line(&format!("function types.read_{name}()"));
self.indent();
self.push_line("local value;");
let statements = &des::gen(&[ty.clone()], &["value".to_string()], true, &mut self.var_occurrences);
let statements = &des::gen(&[ty.clone()], &["value".to_string()], true, &mut HashMap::new());
self.push_stmts(statements);
self.push_line("return value");
self.dedent();
Expand Down

0 comments on commit dd09d10

Please sign in to comment.