From c8443b91816833655eabdfc6ad71b2c2d70bc487 Mon Sep 17 00:00:00 2001 From: Jeremy Wall Date: Wed, 27 Feb 2019 19:52:06 -0600 Subject: [PATCH] MAINT: The great TODO cleanup. --- src/ast/mod.rs | 1 - src/build/compile_test.rs | 2 -- src/build/format.rs | 1 - src/build/ir.rs | 1 - src/build/mod.rs | 9 --------- src/convert/toml.rs | 1 - src/convert/traits.rs | 1 - 7 files changed, 16 deletions(-) diff --git a/src/ast/mod.rs b/src/ast/mod.rs index 7c099f3..c884d53 100644 --- a/src/ast/mod.rs +++ b/src/ast/mod.rs @@ -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, diff --git a/src/build/compile_test.rs b/src/build/compile_test.rs index 75bb47a..35ddd35 100644 --- a/src/build/compile_test.rs +++ b/src/build/compile_test.rs @@ -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( diff --git a/src/build/format.rs b/src/build/format.rs index 5c0b039..736ff54 100644 --- a/src/build/format.rs +++ b/src/build/format.rs @@ -105,7 +105,6 @@ impl<'a> ExpressionFormatter<'a> { pos: &Position, ) -> Result> { // 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() { diff --git a/src/build/ir.rs b/src/build/ir.rs index 37ec984..c566975 100644 --- a/src/build/ir.rs +++ b/src/build/ir.rs @@ -18,7 +18,6 @@ pub enum Val { Float(f64), Str(String), List(Vec>), - // TODO(jwall): Remove the need for PositionedItem here Tuple(Vec<(String, Rc)>), Env(Vec<(String, String)>), Func(FuncDef), diff --git a/src/build/mod.rs b/src/build/mod.rs index de68af6..3e8431c 100644 --- a/src/build/mod.rs +++ b/src/build/mod.rs @@ -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, Box> { self.eval_input(OffsetStrIter::new(input)) @@ -374,7 +372,6 @@ impl<'a> FileBuilder<'a> { ) -> Result> { // 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, Box> { - // 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!( diff --git a/src/convert/toml.rs b/src/convert/toml.rs index 85fc309..2e1d3d9 100644 --- a/src/convert/toml.rs +++ b/src/convert/toml.rs @@ -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)); diff --git a/src/convert/traits.rs b/src/convert/traits.rs index 37cd3ba..badfe17 100644 --- a/src/convert/traits.rs +++ b/src/convert/traits.rs @@ -20,7 +20,6 @@ use std::result; use crate::build::Val; -// TODO Rename to ConvertResult pub type ConvertResult = result::Result<(), Box>; pub type ImportResult = result::Result, Box>;