fix: Python 3.7~3.8 bugs

This commit is contained in:
Shunsuke Shibayama 2023-09-13 11:09:30 +09:00
parent 75c1ac733c
commit aacdca31b8
6 changed files with 35 additions and 4 deletions

View file

@ -385,6 +385,13 @@ impl Args {
pub fn insert_pos(&mut self, idx: usize, pos: PosArg) {
self.pos_args.insert(idx, pos);
}
pub fn get_kw(&self, keyword: &str) -> Option<&Expr> {
self.kw_args
.iter()
.find(|kw| kw.keyword.inspect() == keyword)
.map(|kw| &kw.expr)
}
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]