mirror of
https://github.com/zaphar/ucg.git
synced 2025-07-22 18:19:54 -04:00
MAINT: The great TODO cleanup.
This commit is contained in:
parent
ea3f2eae5f
commit
c8443b9181
@ -529,7 +529,6 @@ impl FuncOpDef {
|
||||
}
|
||||
}
|
||||
|
||||
// TODO(jwall): this should probably be moved to a Val::Module IR type.
|
||||
#[derive(Debug, PartialEq, Clone)]
|
||||
pub struct ModuleDef {
|
||||
pub scope: Option<Scope>,
|
||||
|
@ -524,8 +524,6 @@ fn test_copy_expression_wrong_field_type_compile_failure() {
|
||||
)
|
||||
}
|
||||
|
||||
// TODO(jwall): Function call errors
|
||||
|
||||
#[test]
|
||||
fn test_func_call_wrong_argument_length_compile_failure() {
|
||||
assert_build_failure(
|
||||
|
@ -105,7 +105,6 @@ impl<'a> ExpressionFormatter<'a> {
|
||||
pos: &Position,
|
||||
) -> Result<Val, Box<dyn Error>> {
|
||||
// we expect the next char to be { or we error.
|
||||
// TODO(jwall): Consume until you reach the last '}'
|
||||
let mut expr_string = String::new();
|
||||
let mut brace_count = 0;
|
||||
match iter.next() {
|
||||
|
@ -18,7 +18,6 @@ pub enum Val {
|
||||
Float(f64),
|
||||
Str(String),
|
||||
List(Vec<Rc<Val>>),
|
||||
// TODO(jwall): Remove the need for PositionedItem here
|
||||
Tuple(Vec<(String, Rc<Val>)>),
|
||||
Env(Vec<(String, String)>),
|
||||
Func(FuncDef),
|
||||
|
@ -331,7 +331,6 @@ impl<'a> FileBuilder<'a> {
|
||||
Some(val) => Ok(val),
|
||||
}
|
||||
}
|
||||
// TODO(jwall): We can probably use actual errors now?
|
||||
Err(err) => {
|
||||
let cause = Box::new(simple_error::SimpleError::new(err));
|
||||
Err(error::BuildError::with_pos(
|
||||
@ -345,7 +344,6 @@ impl<'a> FileBuilder<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
// TODO Non file builder specific.
|
||||
/// Evaluate an input string as UCG.
|
||||
pub fn eval_string(&mut self, input: &str) -> Result<Rc<Val>, Box<dyn Error>> {
|
||||
self.eval_input(OffsetStrIter::new(input))
|
||||
@ -374,7 +372,6 @@ impl<'a> FileBuilder<'a> {
|
||||
) -> Result<PathBuf, Box<dyn Error>> {
|
||||
// Try a relative path first.
|
||||
let path = path.into();
|
||||
// TODO(jwall): Change this to take a root directory.
|
||||
let mut normalized = self.working_dir.clone();
|
||||
if path.is_relative() {
|
||||
normalized.push(&path);
|
||||
@ -408,7 +405,6 @@ impl<'a> FileBuilder<'a> {
|
||||
let result = match maybe_asset {
|
||||
Some(v) => v.clone(),
|
||||
None => {
|
||||
// TODO(jwall): This does not need to be a FileBuilder specifically
|
||||
let mut b = self.clone_builder();
|
||||
b.eval_string(self.std.get(&def.path.fragment).unwrap())?;
|
||||
b.get_outputs_as_val()
|
||||
@ -1012,7 +1008,6 @@ impl<'a> FileBuilder<'a> {
|
||||
if let &BinaryExprType::DOT = kind {
|
||||
return self.do_dot_lookup(&def.right, &child_scope);
|
||||
};
|
||||
// TODO(jwall): We need to handle call and copy expressions specially.
|
||||
let right = match self.eval_expr(&def.right, scope) {
|
||||
Ok(v) => v,
|
||||
Err(e) => return Err(e),
|
||||
@ -1143,7 +1138,6 @@ impl<'a> FileBuilder<'a> {
|
||||
let maybe_tpl = mod_def.clone().arg_tuple.unwrap().clone();
|
||||
if let &Val::Tuple(ref src_fields) = maybe_tpl.as_ref() {
|
||||
// 1. First we create a builder.
|
||||
// TODO(jwall): This file should optionally come from the module def itself.
|
||||
let mut b = self.clone_builder();
|
||||
b.is_module = true;
|
||||
// 2. We construct an argument tuple by copying from the defs
|
||||
@ -1272,7 +1266,6 @@ impl<'a> FileBuilder<'a> {
|
||||
Ok(Rc::new(Val::Func(def.clone())))
|
||||
}
|
||||
|
||||
// TODO(jwall): This stays with the FileBuilder specifically.
|
||||
fn file_dir(&self) -> PathBuf {
|
||||
return if self.working_dir.is_file() {
|
||||
// Only use the dirname portion if the root is a file.
|
||||
@ -1284,7 +1277,6 @@ impl<'a> FileBuilder<'a> {
|
||||
}
|
||||
|
||||
fn eval_module_def(&self, def: &ModuleDef, scope: &Scope) -> Result<Rc<Val>, Box<dyn Error>> {
|
||||
// TODO(jwall): This should actually be passed in to here.
|
||||
let root = self.file_dir();
|
||||
// Always work on a copy. The original should not be modified.
|
||||
let mut def = def.clone();
|
||||
@ -1559,7 +1551,6 @@ impl<'a> FileBuilder<'a> {
|
||||
return match maybe_target.as_ref() {
|
||||
&Val::List(ref elems) => self.eval_functional_list_processing(elems, macdef, typ),
|
||||
&Val::Tuple(ref fs) => self.eval_functional_tuple_processing(fs, macdef, typ),
|
||||
// TODO(jwall): Strings?
|
||||
&Val::Str(ref s) => self.eval_functional_string_processing(s, macdef, typ),
|
||||
other => Err(error::BuildError::with_pos(
|
||||
format!(
|
||||
|
@ -61,7 +61,6 @@ impl TomlConverter {
|
||||
fn convert_value(&self, v: &Val) -> Result {
|
||||
let toml_val = match v {
|
||||
&Val::Boolean(b) => toml::Value::Boolean(b),
|
||||
// TODO(jwall): This is an error apparently
|
||||
&Val::Empty => {
|
||||
let err = SimpleError::new("Nulls are not allowed in Toml Conversions!");
|
||||
return Err(Box::new(err));
|
||||
|
@ -20,7 +20,6 @@ use std::result;
|
||||
|
||||
use crate::build::Val;
|
||||
|
||||
// TODO Rename to ConvertResult
|
||||
pub type ConvertResult = result::Result<(), Box<dyn Error>>;
|
||||
|
||||
pub type ImportResult = result::Result<Rc<Val>, Box<dyn Error>>;
|
||||
|
Loading…
x
Reference in New Issue
Block a user