Encapsulate FunctionsLib to hold script-defined functions.
This commit is contained in:
@@ -11,9 +11,7 @@ use crate::optimize::optimize_into_ast;
|
||||
use crate::stdlib::{
|
||||
borrow::Cow,
|
||||
boxed::Box,
|
||||
char,
|
||||
cmp::Ordering,
|
||||
fmt, format,
|
||||
char, fmt, format,
|
||||
iter::Peekable,
|
||||
str::Chars,
|
||||
str::FromStr,
|
||||
@@ -175,18 +173,6 @@ pub struct FnDef {
|
||||
pub pos: Position,
|
||||
}
|
||||
|
||||
impl FnDef {
|
||||
/// Function to order two FnDef records, for binary search.
|
||||
pub fn compare(&self, name: &str, params_len: usize) -> Ordering {
|
||||
// First order by name
|
||||
match self.name.as_str().cmp(name) {
|
||||
// Then by number of parameters
|
||||
Ordering::Equal => self.params.len().cmp(¶ms_len),
|
||||
order => order,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// `return`/`throw` statement.
|
||||
#[derive(Debug, PartialEq, Eq, Hash, Clone, Copy)]
|
||||
pub enum ReturnType {
|
||||
|
Reference in New Issue
Block a user