chore: cleanup
This commit is contained in:
141
src/eval/mod.rs
Normal file
141
src/eval/mod.rs
Normal file
@@ -0,0 +1,141 @@
|
||||
use crate::ty::common::Const;
|
||||
use crate::ty::internal::Value;
|
||||
use crate::ir::{self, Downgraded};
|
||||
use crate::ty::public as p;
|
||||
use crate::error::Result;
|
||||
use crate::engine::Engine;
|
||||
|
||||
pub mod jit;
|
||||
|
||||
pub trait Evaluate {
|
||||
fn eval<'a>(self, engine: &'a Engine) -> Result<Value<'a>>;
|
||||
}
|
||||
|
||||
impl Evaluate for ir::Attrs {
|
||||
fn eval<'a>(self, engine: &'a Engine) -> Result<Value<'a>> {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
impl Evaluate for ir::List {
|
||||
fn eval<'a>(self, engine: &'a Engine) -> Result<Value<'a>> {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
impl Evaluate for ir::HasAttr {
|
||||
fn eval<'a>(self, engine: &'a Engine) -> Result<Value<'a>> {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
impl Evaluate for ir::BinOp {
|
||||
fn eval<'a>(self, engine: &'a Engine) -> Result<Value<'a>> {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
impl Evaluate for ir::UnOp {
|
||||
fn eval<'a>(self, engine: &'a Engine) -> Result<Value<'a>> {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
impl Evaluate for ir::Select {
|
||||
fn eval<'a>(self, engine: &'a Engine) -> Result<Value<'a>> {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
impl Evaluate for ir::If {
|
||||
fn eval<'a>(self, engine: &'a Engine) -> Result<Value<'a>> {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
impl Evaluate for ir::LoadFunc {
|
||||
fn eval<'a>(self, engine: &'a Engine) -> Result<Value<'a>> {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
impl Evaluate for ir::Call {
|
||||
fn eval<'a>(self, engine: &'a Engine) -> Result<Value<'a>> {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
impl Evaluate for ir::Let {
|
||||
fn eval<'a>(self, engine: &'a Engine) -> Result<Value<'a>> {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
impl Evaluate for ir::With {
|
||||
fn eval<'a>(self, engine: &'a Engine) -> Result<Value<'a>> {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
impl Evaluate for ir::Assert {
|
||||
fn eval<'a>(self, engine: &'a Engine) -> Result<Value<'a>> {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
impl Evaluate for ir::ConcatStrings {
|
||||
fn eval<'a>(self, engine: &'a Engine) -> Result<Value<'a>> {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
impl Evaluate for ir::String {
|
||||
fn eval<'a>(self, engine: &'a Engine) -> Result<Value<'a>> {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
impl Evaluate for ir::Const {
|
||||
fn eval<'a>(self, _: &'a Engine) -> Result<Value<'a>> {
|
||||
match self.val {
|
||||
Const::Null => Value::Null,
|
||||
Const::Int(x) => Value::Int(x),
|
||||
Const::Float(x) => Value::Float(x),
|
||||
Const::Bool(x) => Value::Bool(x),
|
||||
}.ok()
|
||||
}
|
||||
}
|
||||
|
||||
impl Evaluate for ir::Var {
|
||||
fn eval<'a>(self, engine: &'a Engine) -> Result<Value<'a>> {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
impl Evaluate for ir::Arg {
|
||||
fn eval<'a>(self, engine: &'a Engine) -> Result<Value<'a>> {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
impl Evaluate for ir::LetVar {
|
||||
fn eval<'a>(self, engine: &'a Engine) -> Result<Value<'a>> {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
impl Evaluate for ir::Thunk {
|
||||
fn eval<'a>(self, engine: &'a Engine) -> Result<Value<'a>> {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
impl Evaluate for ir::Path {
|
||||
fn eval<'a>(self, engine: &'a Engine) -> Result<Value<'a>> {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
pub fn eval(expr: Downgraded) -> Result<p::Value> {
|
||||
todo!()
|
||||
}
|
||||
Reference in New Issue
Block a user