Skip to content

Commit

Permalink
remove dead code
Browse files Browse the repository at this point in the history
  • Loading branch information
katat committed Apr 12, 2024
1 parent 6c56cc0 commit fc65b02
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 44 deletions.
42 changes: 0 additions & 42 deletions src/stdlib/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,48 +21,6 @@ use self::crypto::get_crypto_fn;

pub mod crypto;

pub fn get_std_fn(submodule: &str, fn_name: &str, span: Span) -> Result<FnInfo> {
match submodule {
"crypto" => get_crypto_fn(fn_name)
.ok_or_else(|| {
Error::new(
"type-checker",
ErrorKind::UnknownExternalFn(submodule.to_string(), fn_name.to_string()),
span,
)
}),
_ => Err(Error::new(
"type-checker",
ErrorKind::StdImport(submodule.to_string()),
span,
)),
}
}

/// Takes a list of function signatures (as strings) and their associated function pointer,
/// returns the same list but with the parsed functions (as [FunctionSig]).
pub fn parse_fn_sigs(fn_sigs: &[(&str, FnHandle)]) -> HashMap<String, FnInfo> {
let mut functions = HashMap::new();
let ctx = &mut ParserCtx::default();

for (sig, fn_ptr) in fn_sigs {
// filename_id 0 is for builtins
let mut tokens = Token::parse(0, sig).unwrap();

let sig = FnSig::parse(ctx, &mut tokens).unwrap();

functions.insert(
sig.name.value.clone(),
FnInfo {
kind: FnKind::BuiltIn(sig, *fn_ptr),
span: Span::default(),
},
);
}

functions
}

//
// Builtins or utils (imported by default)
// TODO: give a name that's useful for the user,
Expand Down
4 changes: 2 additions & 2 deletions src/type_checker/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ impl TypeChecker {

// initialize it with the builtins
let builtin_module = ModulePath::Absolute(UserRepo::new(QUALIFIED_BUILTINS));
for fn_info in builtin_fns().iter() {
for fn_info in builtin_fns() {
let qualified = FullyQualified::new(&builtin_module, &fn_info.sig().name.value);
if type_checker
.functions
Expand All @@ -149,7 +149,7 @@ impl TypeChecker {

// initialize it with the standard library
let crypto_module = ModulePath::Absolute(UserRepo::new("std/crypto"));
for fn_info in crypto_fns().iter() {
for fn_info in crypto_fns() {
let qualified = FullyQualified::new(&crypto_module, &fn_info.sig().name.value);
if type_checker
.functions
Expand Down

0 comments on commit fc65b02

Please sign in to comment.