rename stage -> phase

This commit is contained in:
collin 2021-04-21 15:20:22 -07:00
parent 7031923921
commit de685928e2
6 changed files with 19 additions and 19 deletions

View File

@ -57,11 +57,11 @@ pub use prelude::*;
pub mod value;
pub use value::*;
pub mod stage;
pub use stage::*;
pub mod phase;
pub use phase::*;
pub mod stages;
pub use stages::*;
pub mod phases;
pub use phases::*;
pub mod option;
pub use option::*;

View File

@ -16,6 +16,6 @@
use leo_asg::Program;
pub trait ASGStage {
pub trait ASGPhase {
fn apply(asg: &mut Program);
}

View File

@ -19,5 +19,5 @@
pub mod reducing_director;
pub use reducing_director::*;
pub mod stage;
pub use stage::*;
pub mod phase;
pub use phase::*;

View File

@ -20,9 +20,9 @@ use crate::{CombineAstAsgDirector, CombinerOptions};
use leo_asg::Program as AsgProgram;
use leo_ast::{Ast, Program as AstProgram, ReconstructingReducer, ReducerError};
macro_rules! stage {
($stage_name:ident, $function:item) => {
pub struct $stage_name {
macro_rules! phase {
($phase_name:ident, $function:item) => {
pub struct $phase_name {
in_circuit: bool,
}
@ -32,7 +32,7 @@ macro_rules! stage {
$function
}
impl ReconstructingReducer for $stage_name {
impl ReconstructingReducer for $phase_name {
fn in_circuit(&self) -> bool {
self.in_circuit
}
@ -42,14 +42,14 @@ macro_rules! stage {
}
}
impl Default for $stage_name {
impl Default for $phase_name {
fn default() -> Self {
Self { in_circuit: false }
}
}
impl $stage_name {
pub fn stage_ast(&self, ast: &AstProgram, asg: &AsgProgram) -> Result<Ast, ReducerError> {
impl $phase_name {
pub fn phase_ast(&self, ast: &AstProgram, asg: &AsgProgram) -> Result<Ast, ReducerError> {
Ok(Ast::new(CombineAstAsgDirector::new(Self::default(), Options{})
.reduce_program(ast, asg)?))
}
@ -57,8 +57,8 @@ macro_rules! stage {
};
}
stage!(
TypeInferenceStage,
phase!(
TypeInferencePhase,
fn type_inference_enabled(&self) -> bool {
true
}

View File

@ -18,7 +18,7 @@ use crate::{assert_satisfied, parse_program};
#[allow(unused)]
use leo_asg::{new_context, Asg, AsgContext};
use leo_ast::Ast;
use leo_compiler::TypeInferenceStage;
use leo_compiler::TypeInferencePhase;
use leo_imports::ImportParser;
use leo_parser::parser;
@ -47,8 +47,8 @@ pub fn parse_program_ast(file_string: &str) -> Ast {
let asg = Asg::new(thread_leaked_context(), &program, &mut ImportParser::default())
.expect("Failed to create ASG from AST");
let new_ast = TypeInferenceStage::default()
.stage_ast(&program, &asg.into_repr())
let new_ast = TypeInferencePhase::default()
.phase_ast(&program, &asg.into_repr())
.expect("Failed to produce type inference ast.");
new_ast