forked from M-Labs/nac3
1
0
Fork 0

direct impl fold trait on InferenceContext, now code is cleaner, need further test and review

This commit is contained in:
CrescentonC 2021-07-14 17:19:03 +08:00
parent 4abe99f6b3
commit c5bef86001
1 changed files with 2 additions and 0 deletions

View File

@ -8,6 +8,7 @@ use crate::typecheck::primitives;
use rustpython_parser::ast;
use rustpython_parser::ast::fold::Fold;
// REVIEW: direct impl fold trait on InferenceContext
impl<'a> ast::fold::Fold<Option<Type>> for InferenceContext<'a> {
type TargetU = Option<Type>;
type Error = String;
@ -379,6 +380,7 @@ impl<'a> InferenceContext<'a> {
}
}
// some pre-folds need special handling
fn prefold_list_comprehension(&mut self, expr: ast::Expr<Option<Type>>) -> Result<ast::Expr<Option<Type>>, String> {
if let ast::Expr {
location,