direct impl fold trait on InferenceContext, now code is cleaner, need further test and review
This commit is contained in:
parent
4abe99f6b3
commit
c5bef86001
|
@ -8,6 +8,7 @@ use crate::typecheck::primitives;
|
||||||
use rustpython_parser::ast;
|
use rustpython_parser::ast;
|
||||||
use rustpython_parser::ast::fold::Fold;
|
use rustpython_parser::ast::fold::Fold;
|
||||||
|
|
||||||
|
// REVIEW: direct impl fold trait on InferenceContext
|
||||||
impl<'a> ast::fold::Fold<Option<Type>> for InferenceContext<'a> {
|
impl<'a> ast::fold::Fold<Option<Type>> for InferenceContext<'a> {
|
||||||
type TargetU = Option<Type>;
|
type TargetU = Option<Type>;
|
||||||
type Error = String;
|
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> {
|
fn prefold_list_comprehension(&mut self, expr: ast::Expr<Option<Type>>) -> Result<ast::Expr<Option<Type>>, String> {
|
||||||
if let ast::Expr {
|
if let ast::Expr {
|
||||||
location,
|
location,
|
||||||
|
|
Loading…
Reference in New Issue