Skip to content

Commit

Permalink
refactor(ir): Renamed drake-runtime to drake-ir
Browse files Browse the repository at this point in the history
  • Loading branch information
watcol committed Aug 1, 2022
1 parent 06102cb commit ccfca4d
Show file tree
Hide file tree
Showing 10 changed files with 253 additions and 254 deletions.
16 changes: 8 additions & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ members = [
"drake-types",
"drake-lexer",
"drake-parser",
"drake-runtime",
"drake-ir",
]

[dependencies]
2 changes: 1 addition & 1 deletion drake-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ edition = "2021"
drake-types = { path = "../drake-types" }
drake-lexer = { path = "../drake-lexer" }
drake-parser = { path = "../drake-parser" }
drake-runtime = { path = "../drake-runtime" }
drake-ir = { path = "../drake-ir" }
codespan-reporting = "0.11"
somen = "0.3.1"
somen-decode = "0.1"
Expand Down
24 changes: 12 additions & 12 deletions drake-core/src/module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ use alloc::string::String;
use alloc::vec::Vec;
use codespan_reporting::files::Files;
use core::ops::Range;
use drake_runtime::evaluate;
use drake_ir::interpret;
use drake_types::ast::Statement;
use drake_types::error::Error;
use drake_types::runtime::Snapshot;
use drake_types::ir::Ir;

use crate::files::Source;
pub use parse::Token;
Expand All @@ -22,7 +22,7 @@ pub struct Module {
source: Source,
tokens: Option<Vec<Token>>,
ast: Option<Vec<Statement<usize>>>,
snapshot: Option<Snapshot<usize>>,
ir: Option<Ir<usize>>,
errors: Vec<Error<usize>>,
}

Expand Down Expand Up @@ -75,7 +75,7 @@ impl Module {
source: Source::new(source),
tokens: None,
ast: None,
snapshot: None,
ir: None,
errors: Vec::new(),
}
}
Expand Down Expand Up @@ -119,14 +119,14 @@ impl Module {
self.ast.as_ref().unwrap()
}

/// Evaluates the module and returns a reference of the snapshot.
pub async fn evaluate(&mut self) -> &Snapshot<usize> {
/// Interprets the module and returns a reference of IR.
pub async fn evaluate(&mut self) -> &Ir<usize> {
let id = self.file_id;
let (snapshot, mut errors) = evaluate(self.parse().await, id);
let (ir, mut errors) = interpret(self.parse().await, id);

self.errors.append(&mut errors);
self.snapshot = Some(snapshot);
self.snapshot.as_ref().unwrap()
self.ir = Some(ir);
self.ir.as_ref().unwrap()
}

/// Gets a reference for the name of the module.
Expand All @@ -153,9 +153,9 @@ impl Module {
self.ast.as_deref()
}

/// Gets a reference for the evaluated snapshot.
/// Gets a reference for the interpreted IR.
#[inline]
pub fn get_snapshot(&self) -> Option<&Snapshot<usize>> {
self.snapshot.as_ref()
pub fn get_ir(&self) -> Option<&Ir<usize>> {
self.ir.as_ref()
}
}
2 changes: 1 addition & 1 deletion drake-runtime/Cargo.toml → drake-ir/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "drake-runtime"
name = "drake-ir"
version = "0.0.1"
edition = "2021"

Expand Down
Loading

0 comments on commit ccfca4d

Please sign in to comment.