Skip to content

Commit

Permalink
Move push_parameters to mod.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
nezuo committed Nov 26, 2024
1 parent f7a346d commit 3cc16bf
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 32 deletions.
16 changes: 0 additions & 16 deletions zap/src/output/typescript/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,22 +65,6 @@ impl<'src> ClientOutput<'src> {
}
}

fn push_parameters(&mut self, types: &[Ty]) {
let value = self.config.casing.with("Value", "value", "value");

for (i, ty) in types.iter().enumerate() {
if i > 0 {
self.push(", ");
}

self.push(&format!(
"{value}{}",
if i > 0 { (i + 1).to_string() } else { "".to_string() },
));
self.push_arg_ty(ty);
}
}

fn push_return_outgoing(&mut self) {
for (_i, ev) in self
.config
Expand Down
16 changes: 16 additions & 0 deletions zap/src/output/typescript/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,22 @@ pub trait Output: ConfigProvider {
}
}

fn push_parameters(&mut self, types: &[Ty]) {
let value = self.get_config().casing.with("Value", "value", "value");

for (i, ty) in types.iter().enumerate() {
if i > 0 {
self.push(", ");
}

self.push(&format!(
"{value}{}",
if i > 0 { (i + 1).to_string() } else { "".to_string() },
));
self.push_arg_ty(ty);
}
}

fn push_file_header(&mut self, scope: &str) {
self.push_line(&format!(
"// {scope} generated by Zap v{} (https://github.com/red-blox/zap)",
Expand Down
16 changes: 0 additions & 16 deletions zap/src/output/typescript/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,22 +65,6 @@ impl<'a> ServerOutput<'a> {
}
}

fn push_parameters(&mut self, types: &[Ty]) {
let value = self.config.casing.with("Value", "value", "value");

for (i, ty) in types.iter().enumerate() {
if i > 0 {
self.push(", ");
}

self.push(&format!(
"{value}{}",
if i > 0 { (i + 1).to_string() } else { "".to_string() },
));
self.push_arg_ty(ty);
}
}

fn push_return_fire(&mut self, ev: &EvDecl) {
let fire = self.config.casing.with("Fire", "fire", "fire");
let player = self.config.casing.with("Player", "player", "player");
Expand Down

0 comments on commit 3cc16bf

Please sign in to comment.