fn ensure_analysis(&self) {
        if self.analysis.read().is_complete() {
            // Analysis is already known, nothing more to do.
            return;
        }

        use libslide::*;

        // 1. Parse
        let ScanResult {
            tokens,
            diagnostics: scan_diags,
        } = scan(&*self.source);
        let ParseResult {
            program: original,
            diagnostics: parse_diags,
        } = parse_statements(tokens, &self.source);
        let lint_diags = lint_stmt(&original, &self.source);
        // 2. Eval
        let EvaluationResult {
            simplified,
            diagnostics: eval_diags,
        } = evaluate(original.clone(), &self.context).expect("Evaluation failed.");

        // 3. Diagnostics
        let diagnostics = [scan_diags, parse_diags, lint_diags, eval_diags]
            .iter()
            .flat_map(|diags| {
                services::diagnostics::convert_diagnostics(diags, "slide", &self.document_uri)
            })
            .collect();

        // Update fresh analysis
        *self.analysis.write() = Analysis::fresh(original, simplified, diagnostics);
    }
/// Populates a program's [analysis data](Analysis) if it is not already complete.
Populates a program's [analysis data](Analysis) if it is not already complete.
Populates a program ' s [ analysis data ] ( Analysis ) if it is not already complete .
fn ensure_analysis(&self) {
        if self.analysis.read().is_complete() {
            // Analysis is already known, nothing more to do.
            return;
        }
        use libslide::*;
        // 1. Parse
        let ScanResult {
            tokens,
            diagnostics: scan_diags,
        } = scan(&*self.source);
        let ParseResult {
            program: original,
            diagnostics: parse_diags,
        } = parse_statements(tokens, &self.source);
        let lint_diags = lint_stmt(&original, &self.source);
        // 2. Eval
        let EvaluationResult {
            simplified,
            diagnostics: eval_diags,
        } = evaluate(original.clone(), &self.context).expect("Evaluation failed.");
        // 3. Diagnostics
        let diagnostics = [scan_diags, parse_diags, lint_diags, eval_diags]
            .iter()
            .flat_map(|diags| {
                services::diagnostics::convert_diagnostics(diags, "slide", &self.document_uri)
            })
            .collect();
        // Update fresh analysis
        *self.analysis.write() = Analysis::fresh(original, simplified, diagnostics);
    }
fn ensure_analysis ( & self ) { if self . analysis . read ( ) . is_complete ( ) { // Analysis is already known, nothing more to do. return ; } use libslide :: * ; // 1. Parse let ScanResult { tokens , diagnostics : scan_diags , } = scan ( & * self . source ) ; let ParseResult { program : original , diagnostics : parse_diags , } = parse_statements ( tokens , & self . source ) ; let lint_diags = lint_stmt ( & original , & self . source ) ; // 2. Eval let EvaluationResult { simplified , diagnostics : eval_diags , } = evaluate ( original . clone ( ) , & self . context ) . expect ( " " ) ; // 3. Diagnostics let diagnostics = [ scan_diags , parse_diags , lint_diags , eval_diags ] . iter ( ) . flat_map ( | diags | { services :: diagnostics :: convert_diagnostics ( diags , " " , & self . document_uri ) } ) . collect ( ) ; // Update fresh analysis * self . analysis . write ( ) = Analysis :: fresh ( original , simplified , diagnostics ) ; }
Populates a program's [analysis data](Analysis) if it is not already complete.
Populates a program ' s [ analysis data ] ( Analysis ) if it is not already complete .
&self
&self