sway_core/language/
programs.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
use super::{lexed::LexedProgram, parsed::ParseProgram, ty::TyProgram};
use crate::semantic_analysis::program::TypeCheckFailed;
use sway_utils::PerformanceData;

/// Contains the lexed, parsed, typed compilation stages of a program, as well
/// as compilation metrics.
#[derive(Clone, Debug)]
pub struct Programs {
    pub lexed: LexedProgram,
    pub parsed: ParseProgram,
    pub typed: Result<TyProgram, TypeCheckFailed>,
    pub metrics: PerformanceData,
}

impl Programs {
    pub fn new(
        lexed: LexedProgram,
        parsed: ParseProgram,
        typed: Result<TyProgram, TypeCheckFailed>,
        metrics: PerformanceData,
    ) -> Programs {
        Programs {
            lexed,
            parsed,
            typed,
            metrics,
        }
    }
}