pub fn load_sources_with_visitor<'a>(
    context: &Context,
    options: &Options,
    sources: &mut Sources,
    diagnostics: &mut Diagnostics,
    visitor: Rc<dyn compiling::CompileVisitor>,
    source_loader: Rc<dyn SourceLoader + 'a>,
) -> Result<Unit, LoadSourcesError> {
    let unit = if context.has_default_modules() {
        compiling::UnitBuilder::with_default_prelude()
    } else {
        compiling::UnitBuilder::default()
    };

    let result = compiling::compile_with_options(
        &*context,
        sources,
        &unit,
        diagnostics,
        options,
        visitor,
        source_loader,
    );

    if let Err(()) = result {
        return Err(LoadSourcesError);
    }

    if options.link_checks {
        unit.link(&*context, diagnostics);

        if diagnostics.has_error() {
            return Err(LoadSourcesError);
        }
    }

    match unit.build() {
        Ok(unit) => Ok(unit),
        Err(error) => {
            diagnostics.error(0, error);
            Err(LoadSourcesError)
        }
    }
}
/// Load the specified sources with a visitor.
Load the specified sources with a visitor.
Load the specified sources with a visitor .
pub fn load_sources_with_visitor<'a>(
    context: &Context,
    options: &Options,
    sources: &mut Sources,
    diagnostics: &mut Diagnostics,
    visitor: Rc<dyn compiling::CompileVisitor>,
    source_loader: Rc<dyn SourceLoader + 'a>,
) -> Result<Unit, LoadSourcesError> {
    let unit = if context.has_default_modules() {
        compiling::UnitBuilder::with_default_prelude()
    } else {
        compiling::UnitBuilder::default()
    };
    let result = compiling::compile_with_options(
        &*context,
        sources,
        &unit,
        diagnostics,
        options,
        visitor,
        source_loader,
    );
    if let Err(()) = result {
        return Err(LoadSourcesError);
    }
    if options.link_checks {
        unit.link(&*context, diagnostics);
        if diagnostics.has_error() {
            return Err(LoadSourcesError);
        }
    }
    match unit.build() {
        Ok(unit) => Ok(unit),
        Err(error) => {
            diagnostics.error(0, error);
            Err(LoadSourcesError)
        }
    }
}
pub fn load_sources_with_visitor < ' a > ( context : & Context , options : & Options , sources : & mut Sources , diagnostics : & mut Diagnostics , visitor : Rc < dyn compiling :: CompileVisitor > , source_loader : Rc < dyn SourceLoader + ' a > , ) -> Result < Unit , LoadSourcesError > { let unit = if context . has_default_modules ( ) { compiling :: UnitBuilder :: with_default_prelude ( ) } else { compiling :: UnitBuilder :: default ( ) } ; let result = compiling :: compile_with_options ( & * context , sources , & unit , diagnostics , options , visitor , source_loader , ) ; if let Err ( ( ) ) = result { return Err ( LoadSourcesError ) ; } if options . link_checks { unit . link ( & * context , diagnostics ) ; if diagnostics . has_error ( ) { return Err ( LoadSourcesError ) ; } } match unit . build ( ) { Ok ( unit ) => Ok ( unit ) , Err ( error ) => { diagnostics . error ( 0 , error ) ; Err ( LoadSourcesError ) } } }
Load the specified sources with a visitor.
Load the specified sources with a visitor .
context
&Context
options
&Options
sources
&mut Sources
diagnostics
&mut Diagnostics
visitor
Rc<dyn compiling::CompileVisitor>
source_loader
Rc<dyn SourceLoader + 'a>
context
&Context
options
&Options
sources
&mut Sources
diagnostics
&mut Diagnostics
visitor
Rc<dyn compiling::CompileVisitor>
source_loader
Rc<dyn SourceLoader + 'a>