chore: clean up some errors after rebase and rename project to aiken_project

This commit is contained in:
rvcas 2022-10-28 15:06:39 -04:00 committed by Lucas
parent a993bea2a2
commit 483aa0784e
3 changed files with 38 additions and 40 deletions

1
Cargo.lock generated
View File

@ -92,6 +92,7 @@ dependencies = [
"serde_json", "serde_json",
"thiserror", "thiserror",
"toml", "toml",
"uplc",
"walkdir", "walkdir",
] ]

View File

@ -11,6 +11,7 @@ authors = ["Lucas Rosa <x@rvcas.dev>", "Kasey White <kwhitemsg@gmail.com>"]
[dependencies] [dependencies]
aiken-lang = { path = "../lang", version = "0.0.24" } aiken-lang = { path = "../lang", version = "0.0.24" }
ignore = "0.4.18" ignore = "0.4.18"
uplc = { path = '../uplc', version = "0.0.24" }
miette = { version = "5.3.0", features = ["fancy"] } miette = { version = "5.3.0", features = ["fancy"] }
petgraph = "0.6.2" petgraph = "0.6.2"
regex = "1.6.0" regex = "1.6.0"

View File

@ -11,10 +11,10 @@ pub mod format;
pub mod module; pub mod module;
use aiken_lang::{ use aiken_lang::{
ast::{Definition, Function, ModuleKind}, ast::{self, Definition, Function, ModuleKind},
builtins, builtins,
expr::TypedExpr, expr::TypedExpr,
tipo::TypeInfo, tipo::{self, TypeInfo},
IdGenerator, IdGenerator,
}; };
use uplc::{ use uplc::{
@ -26,7 +26,7 @@ use uplc::{
use crate::{ use crate::{
config::Config, config::Config,
error::{Error, Warning}, error::{Error, Warning},
module::{self, CheckedModule, CheckedModules, ParsedModule, ParsedModules}, module::{CheckedModule, CheckedModules, ParsedModule, ParsedModules},
}; };
#[derive(Debug)] #[derive(Debug)]
@ -424,17 +424,15 @@ impl Project {
&aiken_lang::ast::ModuleConstant<std::sync::Arc<aiken_lang::tipo::Type>, String>, &aiken_lang::ast::ModuleConstant<std::sync::Arc<aiken_lang::tipo::Type>, String>,
>, >,
) -> Term<uplc::ast::Name> { ) -> Term<uplc::ast::Name> {
let terms = match dbg!(body) { match dbg!(body) {
aiken_lang::expr::TypedExpr::Int { value, .. } => { TypedExpr::Int { value, .. } => {
Term::Constant(Constant::Integer(value.parse::<i128>().unwrap())) Term::Constant(Constant::Integer(value.parse::<i128>().unwrap()))
} }
aiken_lang::expr::TypedExpr::String { value, .. } => { TypedExpr::String { value, .. } => Term::Constant(Constant::String(value.clone())),
Term::Constant(Constant::String(value.clone())) TypedExpr::ByteArray { bytes, .. } => {
}
aiken_lang::expr::TypedExpr::ByteArray { bytes, .. } => {
Term::Constant(Constant::ByteString(bytes.clone())) Term::Constant(Constant::ByteString(bytes.clone()))
} }
aiken_lang::expr::TypedExpr::Sequence { TypedExpr::Sequence {
location, location,
expressions, expressions,
} => { } => {
@ -456,11 +454,11 @@ impl Project {
uplc_function_holder.pop().unwrap() uplc_function_holder.pop().unwrap()
} }
aiken_lang::expr::TypedExpr::Pipeline { TypedExpr::Pipeline {
location, location,
expressions, expressions,
} => todo!(), } => todo!(),
aiken_lang::expr::TypedExpr::Var { TypedExpr::Var {
location, location,
constructor, constructor,
name, name,
@ -469,18 +467,18 @@ impl Project {
Term::Constant(Constant::Bool(name == "True")) Term::Constant(Constant::Bool(name == "True"))
} else { } else {
match constructor.variant.clone() { match constructor.variant.clone() {
aiken_lang::tipo::ValueConstructorVariant::LocalVariable { location } => { tipo::ValueConstructorVariant::LocalVariable { location } => {
Term::Var(Name { Term::Var(Name {
text: name.to_string(), text: name.to_string(),
unique: 0.into(), unique: 0.into(),
}) })
} }
aiken_lang::tipo::ValueConstructorVariant::ModuleConstant { tipo::ValueConstructorVariant::ModuleConstant {
location, location,
module, module,
literal, literal,
} => todo!(), } => todo!(),
aiken_lang::tipo::ValueConstructorVariant::ModuleFn { tipo::ValueConstructorVariant::ModuleFn {
name, name,
field_map, field_map,
module, module,
@ -488,7 +486,7 @@ impl Project {
location, location,
builtin, builtin,
} => todo!(), } => todo!(),
aiken_lang::tipo::ValueConstructorVariant::Record { tipo::ValueConstructorVariant::Record {
name, name,
arity, arity,
field_map, field_map,
@ -499,7 +497,7 @@ impl Project {
} }
} }
} }
aiken_lang::expr::TypedExpr::Fn { TypedExpr::Fn {
location, location,
tipo, tipo,
is_capture, is_capture,
@ -507,19 +505,19 @@ impl Project {
body, body,
return_annotation, return_annotation,
} => todo!(), } => todo!(),
aiken_lang::expr::TypedExpr::List { TypedExpr::List {
location, location,
tipo, tipo,
elements, elements,
tail, tail,
} => todo!(), } => todo!(),
aiken_lang::expr::TypedExpr::Call { TypedExpr::Call {
location, location,
tipo, tipo,
fun, fun,
args, args,
} => todo!(), } => todo!(),
aiken_lang::expr::TypedExpr::BinOp { TypedExpr::BinOp {
location, location,
tipo, tipo,
name, name,
@ -528,16 +526,16 @@ impl Project {
} => { } => {
todo!() todo!()
} }
aiken_lang::expr::TypedExpr::Assignment { TypedExpr::Assignment {
location, location,
tipo, tipo,
value, value,
pattern, pattern,
kind, kind,
} => match pattern { } => match pattern {
aiken_lang::ast::Pattern::Int { location, value } => todo!(), ast::Pattern::Int { location, value } => todo!(),
aiken_lang::ast::Pattern::String { location, value } => todo!(), ast::Pattern::String { location, value } => todo!(),
aiken_lang::ast::Pattern::Var { location, name } => Term::Apply { ast::Pattern::Var { location, name } => Term::Apply {
function: Rc::new(Term::Lambda { function: Rc::new(Term::Lambda {
parameter_name: Name { parameter_name: Name {
text: name.to_string(), text: name.to_string(),
@ -559,23 +557,23 @@ impl Project {
) )
.into(), .into(),
}, },
aiken_lang::ast::Pattern::VarUsage { ast::Pattern::VarUsage {
location, location,
name, name,
tipo, tipo,
} => todo!(), } => todo!(),
aiken_lang::ast::Pattern::Assign { ast::Pattern::Assign {
name, name,
location, location,
pattern, pattern,
} => todo!(), } => todo!(),
aiken_lang::ast::Pattern::Discard { name, location } => todo!(), ast::Pattern::Discard { name, location } => todo!(),
aiken_lang::ast::Pattern::List { ast::Pattern::List {
location, location,
elements, elements,
tail, tail,
} => todo!(), } => todo!(),
aiken_lang::ast::Pattern::Constructor { ast::Pattern::Constructor {
location, location,
name, name,
arguments, arguments,
@ -585,21 +583,21 @@ impl Project {
tipo, tipo,
} => todo!(), } => todo!(),
}, },
aiken_lang::expr::TypedExpr::Try { TypedExpr::Try {
location, location,
tipo, tipo,
value, value,
then, then,
pattern, pattern,
} => todo!(), } => todo!(),
aiken_lang::expr::TypedExpr::When { TypedExpr::When {
location, location,
tipo, tipo,
subjects, subjects,
clauses, clauses,
} => todo!(), } => todo!(),
//if statements increase scope due to branching. //if statements increase scope due to branching.
aiken_lang::expr::TypedExpr::If { TypedExpr::If {
branches, branches,
final_else, final_else,
.. ..
@ -660,14 +658,14 @@ impl Project {
} }
Term::Force(Rc::new(final_if_term)) Term::Force(Rc::new(final_if_term))
} }
aiken_lang::expr::TypedExpr::RecordAccess { TypedExpr::RecordAccess {
location, location,
tipo, tipo,
label, label,
index, index,
record, record,
} => todo!(), } => todo!(),
aiken_lang::expr::TypedExpr::ModuleSelect { TypedExpr::ModuleSelect {
location, location,
tipo, tipo,
label, label,
@ -675,21 +673,19 @@ impl Project {
module_alias, module_alias,
constructor, constructor,
} => todo!(), } => todo!(),
aiken_lang::expr::TypedExpr::Todo { TypedExpr::Todo {
location, location,
label, label,
tipo, tipo,
} => todo!(), } => todo!(),
aiken_lang::expr::TypedExpr::RecordUpdate { TypedExpr::RecordUpdate {
location, location,
tipo, tipo,
spread, spread,
args, args,
} => todo!(), } => todo!(),
aiken_lang::expr::TypedExpr::Negate { location, value } => todo!(), TypedExpr::Negate { location, value } => todo!(),
}; }
terms
} }
fn aiken_files(&mut self, dir: &Path, kind: ModuleKind) -> Result<(), Error> { fn aiken_files(&mut self, dir: &Path, kind: ModuleKind) -> Result<(), Error> {