Skip to content

Commit 7a04976

Browse files
authored
Merge pull request #513 from davidcole1340/revert-511-373-stubs-missing-for-rustclosure
Revert "feat(stubs): add stubs for `RustClosure`"
2 parents 31c9d99 + b9f60ee commit 7a04976

File tree

3 files changed

+7
-67
lines changed

3 files changed

+7
-67
lines changed

src/args.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,6 @@ impl From<Arg<'_>> for Parameter {
203203
name: val.name.into(),
204204
ty: Some(val.r#type).into(),
205205
nullable: val.allow_null,
206-
variadic: val.variadic,
207206
default: val.default_value.map(abi::RString::from).into(),
208207
}
209208
}

src/describe/mod.rs

Lines changed: 7 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -76,25 +76,19 @@ pub struct Module {
7676
impl From<ModuleBuilder<'_>> for Module {
7777
fn from(builder: ModuleBuilder) -> Self {
7878
let functions = builder.functions;
79-
80-
#[allow(unused_mut)]
81-
let mut classes = builder
82-
.classes
83-
.into_iter()
84-
.map(|c| c().into())
85-
.collect::<StdVec<_>>();
86-
87-
#[cfg(feature = "closure")]
88-
classes.push(Class::closure());
89-
9079
Self {
9180
name: builder.name.into(),
9281
functions: functions
9382
.into_iter()
9483
.map(Function::from)
9584
.collect::<StdVec<_>>()
9685
.into(),
97-
classes: classes.into(),
86+
classes: builder
87+
.classes
88+
.into_iter()
89+
.map(|c| c().into())
90+
.collect::<StdVec<_>>()
91+
.into(),
9892
constants: builder
9993
.constants
10094
.into_iter()
@@ -157,8 +151,6 @@ pub struct Parameter {
157151
pub ty: Option<DataType>,
158152
/// Whether the parameter is nullable.
159153
pub nullable: bool,
160-
/// Whether the parameter is variadic.
161-
pub variadic: bool,
162154
/// Default value of the parameter.
163155
pub default: Option<RString>,
164156
}
@@ -183,43 +175,6 @@ pub struct Class {
183175
pub constants: Vec<Constant>,
184176
}
185177

186-
#[cfg(feature = "closure")]
187-
impl Class {
188-
/// Creates a new class representing a Rust closure used for generating
189-
/// the stubs if the `closure` feature is enabled.
190-
#[must_use]
191-
pub fn closure() -> Self {
192-
Self {
193-
name: "RustClosure".into(),
194-
docs: DocBlock(StdVec::new().into()),
195-
extends: Option::None,
196-
implements: StdVec::new().into(),
197-
properties: StdVec::new().into(),
198-
methods: vec![Method {
199-
name: "__invoke".into(),
200-
docs: DocBlock(StdVec::new().into()),
201-
ty: MethodType::Member,
202-
params: vec![Parameter {
203-
name: "args".into(),
204-
ty: Option::Some(DataType::Mixed),
205-
nullable: false,
206-
variadic: true,
207-
default: Option::None,
208-
}]
209-
.into(),
210-
retval: Option::Some(Retval {
211-
ty: DataType::Mixed,
212-
nullable: false,
213-
}),
214-
r#static: false,
215-
visibility: Visibility::Public,
216-
}]
217-
.into(),
218-
constants: StdVec::new().into(),
219-
}
220-
}
221-
}
222-
223178
impl From<ClassBuilder> for Class {
224179
fn from(val: ClassBuilder) -> Self {
225180
Self {
@@ -471,8 +426,6 @@ impl From<(String, Box<dyn IntoConst + Send>, DocComments)> for Constant {
471426
#[cfg(test)]
472427
mod tests {
473428
#![cfg_attr(windows, feature(abi_vectorcall))]
474-
use cfg_if::cfg_if;
475-
476429
use super::*;
477430

478431
use crate::{args::Arg, test::test_function};
@@ -507,13 +460,7 @@ mod tests {
507460
let module: Module = builder.into();
508461
assert_eq!(module.name, "test".into());
509462
assert_eq!(module.functions.len(), 1);
510-
cfg_if! {
511-
if #[cfg(feature = "closure")] {
512-
assert_eq!(module.classes.len(), 1);
513-
} else {
514-
assert_eq!(module.classes.len(), 0);
515-
}
516-
}
463+
assert_eq!(module.classes.len(), 0);
517464
assert_eq!(module.constants.len(), 0);
518465
}
519466

@@ -532,7 +479,6 @@ mod tests {
532479
name: "foo".into(),
533480
ty: Option::Some(DataType::Long),
534481
nullable: false,
535-
variadic: false,
536482
default: Option::None,
537483
}]
538484
.into()
@@ -622,7 +568,6 @@ mod tests {
622568
name: "foo".into(),
623569
ty: Option::Some(DataType::Long),
624570
nullable: false,
625-
variadic: false,
626571
default: Option::None,
627572
}]
628573
.into()

src/describe/stub.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,10 +154,6 @@ impl ToStub for Parameter {
154154
write!(buf, " ")?;
155155
}
156156

157-
if self.variadic {
158-
write!(buf, "...")?;
159-
}
160-
161157
write!(buf, "${}", self.name)
162158
}
163159
}

0 commit comments

Comments
 (0)