pub fn add(&mut self, elab: &mut Elaborator, sp: Span, it: impl Iterator<Item=LispVal>) -> Result<()> {
    let fsp = FileSpan {file: elab.path.clone(), span: sp};
    let p = Parser {fe: elab.format_env(), kw: &self.keywords};
    let mut errors = vec![];
    for e in it {
      let mut it = ItemIter::new(e);
      while let Some(item) = p.parse_next_item(&fsp, &mut it)? {
        macro_rules! try1 {($e:expr) => {
          match $e { Ok(r) => r, Err(e) => {errors.push(e); continue}}
        }}
        try1!(Self::reserve_names(&mut self.names, &item));
        let mut ba = BuildAst::new(&self.names, p);
        let item = try1!(ba.build_item(item));
        let BuildAst {var_names, ..} = ba;
        let hir_alloc = Bump::new();
        let mm0_alloc = Default::default();
        let mut ctx = infer::InferCtx::new(&hir_alloc, &mm0_alloc,
          &mut self.names, p.fe, var_names);
        let _item = ctx.lower_item(&item);
        let errs = std::mem::take(&mut ctx.errors);
        let pr = ctx.print();
        errors.extend(errs.into_iter().map(|e| e.into_elab_error(&pr)));
      }
    }
    for e in errors { elab.report(e) }
    // for a in &ast { self.nameck(&fsp, a)? }
    // let mut tc = TypeChecker::new(self, elab, fsp);
    // for item in ast { tc.typeck(&item)? }
    Ok(())
  }
/// Add the given MMC text (as a list of lisp literals) to the compiler state,
/// performing typehecking but not code generation. This can be called multiple
/// times to add multiple functions, but each lisp literal is already a list of
/// top level items that are typechecked as a unit.
Add the given MMC text (as a list of lisp literals) to the compiler state,
performing typehecking but not code generation. This can be called multiple
times to add multiple functions, but each lisp literal is already a list of
top level items that are typechecked as a unit.
Add the given MMC text ( as a list of lisp literals ) to the compiler state performing typehecking but not code generation . This can be called multiple times to add multiple functions but each lisp literal is already a list of top level items that are typechecked as a unit .
pub fn add(&mut self, elab: &mut Elaborator, sp: Span, it: impl Iterator<Item=LispVal>) -> Result<()> {
    let fsp = FileSpan {file: elab.path.clone(), span: sp};
    let p = Parser {fe: elab.format_env(), kw: &self.keywords};
    let mut errors = vec![];
    for e in it {
      let mut it = ItemIter::new(e);
      while let Some(item) = p.parse_next_item(&fsp, &mut it)? {
        macro_rules! try1 {($e:expr) => {
          match $e { Ok(r) => r, Err(e) => {errors.push(e); continue}}
        }}
        try1!(Self::reserve_names(&mut self.names, &item));
        let mut ba = BuildAst::new(&self.names, p);
        let item = try1!(ba.build_item(item));
        let BuildAst {var_names, ..} = ba;
        let hir_alloc = Bump::new();
        let mm0_alloc = Default::default();
        let mut ctx = infer::InferCtx::new(&hir_alloc, &mm0_alloc,
          &mut self.names, p.fe, var_names);
        let _item = ctx.lower_item(&item);
        let errs = std::mem::take(&mut ctx.errors);
        let pr = ctx.print();
        errors.extend(errs.into_iter().map(|e| e.into_elab_error(&pr)));
      }
    }
    for e in errors { elab.report(e) }
    // for a in &ast { self.nameck(&fsp, a)? }
    // let mut tc = TypeChecker::new(self, elab, fsp);
    // for item in ast { tc.typeck(&item)? }
    Ok(())
  }
pub fn add ( & mut self , elab : & mut Elaborator , sp : Span , it : impl Iterator < Item = LispVal > ) -> Result < ( ) > { let fsp = FileSpan { file : elab . path . clone ( ) , span : sp } ; let p = Parser { fe : elab . format_env ( ) , kw : & self . keywords } ; let mut errors = vec ! [ ] ; for e in it { let mut it = ItemIter :: new ( e ) ; while let Some ( item ) = p . parse_next_item ( & fsp , & mut it ) ? { macro_rules! try1 { ( $e : expr ) => { match $e { Ok ( r ) r Err ( e ) { errors push ( e ) continue } } } } try1 ! ( Self reserve_names ( mut self names item ) ) ; let mut ba = BuildAst :: new ( & self . names , p ) ; let item = try1 ! ( ba build_item ( item ) ) ; let BuildAst { var_names , .. } = ba ; let hir_alloc = Bump :: new ( ) ; let mm0_alloc = Default :: default ( ) ; let mut ctx = infer :: InferCtx :: new ( & hir_alloc , & mm0_alloc , & mut self . names , p . fe , var_names ) ; let _item = ctx . lower_item ( & item ) ; let errs = std :: mem :: take ( & mut ctx . errors ) ; let pr = ctx . print ( ) ; errors . extend ( errs . into_iter ( ) . map ( | e | e . into_elab_error ( & pr ) ) ) ; } } for e in errors { elab . report ( e ) } // for a in &ast { self.nameck(&fsp, a)? } // let mut tc = TypeChecker::new(self, elab, fsp); // for item in ast { tc.typeck(&item)? } Ok ( ( ) ) }
Add the given MMC text (as a list of lisp literals) to the compiler state,
performing typehecking but not code generation.
Add the given MMC text ( as a list of lisp literals ) to the compiler state performing typehecking but not code generation .
&mut self
elab
&mut Elaborator
sp
Span
it
impl Iterator<Item=LispVal>
&mut self
elab
&mut Elaborator
sp
Span
it
impl Iterator<Item=LispVal>