Skip to content

Commit b39d8f0

Browse files
robertoaloimeta-codesync[bot]
authored andcommitted
Allow meta-only dynamic call patterns
Reviewed By: alanz Differential Revision: D85553363 fbshipit-source-id: 8349945a9f8a5732fb8a2ea2a930bc2c1a2ada18
1 parent 61af236 commit b39d8f0

File tree

2 files changed

+100
-98
lines changed

2 files changed

+100
-98
lines changed

crates/hir/src/sema/to_def.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -786,19 +786,20 @@ use lazy_static::lazy_static;
786786

787787
/// Pattern for matching dynamic call expressions (apply, rpc calls, etc.)
788788
#[derive(Debug, Clone)]
789-
struct DynamicCallPattern {
789+
pub(crate) struct DynamicCallPattern {
790790
/// Index of the target module argument (None when target function is in same module)
791-
module_arg_index: Option<usize>,
791+
pub(crate) module_arg_index: Option<usize>,
792792
/// Index of the target function argument
793-
function_arg_index: usize,
793+
pub(crate) function_arg_index: usize,
794794
/// Index of the arguments list or arity argument
795-
args_list_index: usize,
795+
pub(crate) args_list_index: usize,
796796
/// Whether to extract arity directly from an integer argument (true) or from list length (false)
797-
direct_arity: bool,
797+
pub(crate) direct_arity: bool,
798798
}
799799

800-
type PatternKey = (Option<&'static str>, &'static str, usize);
800+
pub(crate) type PatternKey = (Option<&'static str>, &'static str, usize);
801801

802+
#[macro_export]
802803
macro_rules! add_patterns {
803804
($patterns:ident, [$(($module:expr, $func:literal, $arity:literal, $module_idx:expr, $func_idx:literal, $args_idx:literal, $direct:expr)),* $(,)?]) => {
804805
$(
@@ -889,6 +890,7 @@ lazy_static! {
889890
static ref DYNAMIC_CALL_PATTERNS: FxHashMap<PatternKey, DynamicCallPattern> = {
890891
let mut patterns = FxHashMap::default();
891892
add_dynamic_call_patterns(&mut patterns);
893+
// @fb-only
892894
patterns
893895
};
894896
}

0 commit comments

Comments
 (0)