diff options
Diffstat (limited to 'src/run/mod.rs')
| -rw-r--r-- | src/run/mod.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/run/mod.rs b/src/run/mod.rs index f86278d..c3ceb76 100644 --- a/src/run/mod.rs +++ b/src/run/mod.rs @@ -456,8 +456,9 @@ impl Executor { stdout: OutputWriter, ) -> SpawnedCmd { for branch in c.branches.into_iter() { - // TODO: regex case patterns - if branch.pattern == c.discriminant { + // TODO: do not compile every time + let compiled = branch.pattern.compile(); + if compiled.matches(&c.discriminant) { return self.execute_block(branch.block, stdin, stdout); } } @@ -732,6 +733,8 @@ const BUILTINS: &[&'static dyn BuiltinClone] = &[ &builtin::logo, &builtin::export, &builtin::pish_theme, + #[cfg(debug_assertions)] + &builtin::case_match, ]; pub fn builtin_map() -> HashMap<BString, &'static dyn BuiltinClone> { |
