Warning cleanup, TODOs

This commit is contained in:
greg 2019-09-10 03:40:41 -07:00
parent 22887678bd
commit 6c3a4f907b
5 changed files with 9 additions and 5 deletions

View File

@ -3,6 +3,7 @@
## General code cleanup ## General code cleanup
-turn ast reduction into methods-on-struct-returning-result format -turn ast reduction into methods-on-struct-returning-result format
-implement and test open/use statements -implement and test open/use statements
-implement field access
- standardize on an error type that isn't String - standardize on an error type that isn't String
-implement a visitor pattern for the use of scope_resolver -implement a visitor pattern for the use of scope_resolver

View File

@ -6,11 +6,12 @@ use crate::builtin::Builtin;
#[derive(Debug, PartialEq, Clone)] #[derive(Debug, PartialEq, Clone)]
pub struct PrefixOp { pub struct PrefixOp {
pub sigil: Rc<String>, sigil: Rc<String>,
pub builtin: Option<Builtin>, pub builtin: Option<Builtin>,
} }
impl PrefixOp { impl PrefixOp {
#[allow(dead_code)]
pub fn sigil(&self) -> &Rc<String> { pub fn sigil(&self) -> &Rc<String> {
&self.sigil &self.sigil
} }

View File

@ -286,7 +286,8 @@ impl<'a> State<'a> {
let evaled_args = evaled_args?; let evaled_args = evaled_args?;
Ok(match (builtin, evaled_args.as_slice()) { Ok(match (builtin, evaled_args.as_slice()) {
(FieldAccess, &[Node::PrimObject { ref name, ref tag, ref items }]) => { (FieldAccess, &[Node::PrimObject { .. }]) => {
//TODO implement field access
unimplemented!() unimplemented!()
}, },
(binop, &[Node::Expr(ref lhs), Node::Expr(ref rhs)]) => match (binop, lhs, rhs) { (binop, &[Node::Expr(ref lhs), Node::Expr(ref rhs)]) => match (binop, lhs, rhs) {

View File

@ -16,7 +16,7 @@ use std::rc::Rc;
use std::str::FromStr; use std::str::FromStr;
use crate::ast::*; use crate::ast::*;
use crate::symbol_table::{Symbol, SymbolSpec, SymbolTable, ScopeSegment, ScopeSegmentKind, FullyQualifiedSymbolName}; use crate::symbol_table::{Symbol, SymbolSpec, SymbolTable, FullyQualifiedSymbolName};
use crate::builtin::Builtin; use crate::builtin::Builtin;
#[derive(Debug)] #[derive(Debug)]
@ -194,7 +194,7 @@ fn reduce_lambda(params: &Vec<FormalParam>, body: &Block, symbol_table: &SymbolT
}) })
} }
fn reduce_named_struct(fqsn: Option<&FullyQualifiedSymbolName>, name: &QualifiedName, fields: &Vec<(Rc<String>, Meta<Expression>)>, symbol_table: &SymbolTable) -> Expr { fn reduce_named_struct(fqsn: Option<&FullyQualifiedSymbolName>, _name: &QualifiedName, fields: &Vec<(Rc<String>, Meta<Expression>)>, symbol_table: &SymbolTable) -> Expr {
let sym_name = match fqsn { let sym_name = match fqsn {
Some(fqsn) => fqsn, Some(fqsn) => fqsn,
None => return Expr::ReductionError(format!("FQSN lookup for value B failed")), None => return Expr::ReductionError(format!("FQSN lookup for value B failed")),
@ -397,7 +397,7 @@ impl Pattern {
} }
impl PatternLiteral { impl PatternLiteral {
fn to_subpattern(&self, symbol_table: &SymbolTable) -> Subpattern { fn to_subpattern(&self, _symbol_table: &SymbolTable) -> Subpattern {
use self::PatternLiteral::*; use self::PatternLiteral::*;
match self { match self {
NumPattern { neg, num } => { NumPattern { neg, num } => {

View File

@ -37,6 +37,7 @@ impl TypeError {
} }
} }
#[allow(dead_code)] // avoids warning from Compound
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub enum Type { pub enum Type {
Const(TypeConst), Const(TypeConst),