Add gen_fn_siguatures API.

This commit is contained in:
Stephen Chung
2020-11-22 17:21:34 +08:00
parent 739dce72e3
commit 07fe132e1a
17 changed files with 400 additions and 83 deletions

View File

@@ -286,6 +286,9 @@ mod generate_tests {
fn is_method_call(&self) -> bool { false }
fn is_variadic(&self) -> bool { false }
fn clone_boxed(&self) -> Box<dyn PluginFunction> { Box::new(Token()) }
fn input_names(&self) -> Box<[&'static str]> {
new_vec![].into_boxed_slice()
}
fn input_types(&self) -> Box<[TypeId]> {
new_vec![].into_boxed_slice()
}
@@ -293,6 +296,9 @@ mod generate_tests {
pub fn token_callable() -> CallableFunction {
Token().into()
}
pub fn token_input_names() -> Box<[&'static str]> {
Token().input_names()
}
pub fn token_input_types() -> Box<[TypeId]> {
Token().input_types()
}
@@ -328,6 +334,9 @@ mod generate_tests {
fn is_method_call(&self) -> bool { false }
fn is_variadic(&self) -> bool { false }
fn clone_boxed(&self) -> Box<dyn PluginFunction> { Box::new(Token()) }
fn input_names(&self) -> Box<[&'static str]> {
new_vec!["x: usize"].into_boxed_slice()
}
fn input_types(&self) -> Box<[TypeId]> {
new_vec![TypeId::of::<usize>()].into_boxed_slice()
}
@@ -335,6 +344,9 @@ mod generate_tests {
pub fn token_callable() -> CallableFunction {
Token().into()
}
pub fn token_input_names() -> Box<[&'static str]> {
Token().input_names()
}
pub fn token_input_types() -> Box<[TypeId]> {
Token().input_types()
}
@@ -370,6 +382,9 @@ mod generate_tests {
fn is_method_call(&self) -> bool { false }
fn is_variadic(&self) -> bool { false }
fn clone_boxed(&self) -> Box<dyn PluginFunction> { Box::new(Token()) }
fn input_names(&self) -> Box<[&'static str]> {
new_vec!["x: usize"].into_boxed_slice()
}
fn input_types(&self) -> Box<[TypeId]> {
new_vec![TypeId::of::<usize>()].into_boxed_slice()
}
@@ -377,6 +392,9 @@ mod generate_tests {
pub fn token_callable() -> CallableFunction {
Token().into()
}
pub fn token_input_names() -> Box<[&'static str]> {
Token().input_names()
}
pub fn token_input_types() -> Box<[TypeId]> {
Token().input_types()
}
@@ -414,6 +432,9 @@ mod generate_tests {
fn is_method_call(&self) -> bool { false }
fn is_variadic(&self) -> bool { false }
fn clone_boxed(&self) -> Box<dyn PluginFunction> { Box::new(Token()) }
fn input_names(&self) -> Box<[&'static str]> {
new_vec![].into_boxed_slice()
}
fn input_types(&self) -> Box<[TypeId]> {
new_vec![].into_boxed_slice()
}
@@ -421,6 +442,9 @@ mod generate_tests {
pub fn token_callable() -> CallableFunction {
Token().into()
}
pub fn token_input_names() -> Box<[&'static str]> {
Token().input_names()
}
pub fn token_input_types() -> Box<[TypeId]> {
Token().input_types()
}
@@ -452,6 +476,9 @@ mod generate_tests {
fn is_method_call(&self) -> bool { false }
fn is_variadic(&self) -> bool { false }
fn clone_boxed(&self) -> Box<dyn PluginFunction> { Box::new(MyType()) }
fn input_names(&self) -> Box<[&'static str]> {
new_vec!["x: usize"].into_boxed_slice()
}
fn input_types(&self) -> Box<[TypeId]> {
new_vec![TypeId::of::<usize>()].into_boxed_slice()
}
@@ -485,6 +512,9 @@ mod generate_tests {
fn is_method_call(&self) -> bool { false }
fn is_variadic(&self) -> bool { false }
fn clone_boxed(&self) -> Box<dyn PluginFunction> { Box::new(Token()) }
fn input_names(&self) -> Box<[&'static str]> {
new_vec!["x: usize", "y: usize"].into_boxed_slice()
}
fn input_types(&self) -> Box<[TypeId]> {
new_vec![TypeId::of::<usize>(),
TypeId::of::<usize>()].into_boxed_slice()
@@ -493,6 +523,9 @@ mod generate_tests {
pub fn token_callable() -> CallableFunction {
Token().into()
}
pub fn token_input_names() -> Box<[&'static str]> {
Token().input_names()
}
pub fn token_input_types() -> Box<[TypeId]> {
Token().input_types()
}
@@ -529,6 +562,9 @@ mod generate_tests {
fn is_method_call(&self) -> bool { true }
fn is_variadic(&self) -> bool { false }
fn clone_boxed(&self) -> Box<dyn PluginFunction> { Box::new(Token()) }
fn input_names(&self) -> Box<[&'static str]> {
new_vec!["x: &mut usize", "y: usize"].into_boxed_slice()
}
fn input_types(&self) -> Box<[TypeId]> {
new_vec![TypeId::of::<usize>(),
TypeId::of::<usize>()].into_boxed_slice()
@@ -537,6 +573,9 @@ mod generate_tests {
pub fn token_callable() -> CallableFunction {
Token().into()
}
pub fn token_input_names() -> Box<[&'static str]> {
Token().input_names()
}
pub fn token_input_types() -> Box<[TypeId]> {
Token().input_types()
}
@@ -573,6 +612,9 @@ mod generate_tests {
fn is_method_call(&self) -> bool { false }
fn is_variadic(&self) -> bool { false }
fn clone_boxed(&self) -> Box<dyn PluginFunction> { Box::new(Token()) }
fn input_names(&self) -> Box<[&'static str]> {
new_vec!["message: &str"].into_boxed_slice()
}
fn input_types(&self) -> Box<[TypeId]> {
new_vec![TypeId::of::<ImmutableString>()].into_boxed_slice()
}
@@ -580,6 +622,9 @@ mod generate_tests {
pub fn token_callable() -> CallableFunction {
Token().into()
}
pub fn token_input_names() -> Box<[&'static str]> {
Token().input_names()
}
pub fn token_input_types() -> Box<[TypeId]> {
Token().input_types()
}