From 6c3a4f907b1378bcbd45efddc4407108348f63e9 Mon Sep 17 00:00:00 2001 From: greg Date: Tue, 10 Sep 2019 03:40:41 -0700 Subject: [PATCH] Warning cleanup, TODOs --- TODO.md | 1 + schala-lang/language/src/ast/operators.rs | 3 ++- schala-lang/language/src/eval.rs | 3 ++- schala-lang/language/src/reduced_ast.rs | 6 +++--- schala-lang/language/src/typechecking.rs | 1 + 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/TODO.md b/TODO.md index cf0804c..ae0ef74 100644 --- a/TODO.md +++ b/TODO.md @@ -3,6 +3,7 @@ ## General code cleanup -turn ast reduction into methods-on-struct-returning-result format -implement and test open/use statements +-implement field access - standardize on an error type that isn't String -implement a visitor pattern for the use of scope_resolver diff --git a/schala-lang/language/src/ast/operators.rs b/schala-lang/language/src/ast/operators.rs index 217a1a4..5b14d6a 100644 --- a/schala-lang/language/src/ast/operators.rs +++ b/schala-lang/language/src/ast/operators.rs @@ -6,11 +6,12 @@ use crate::builtin::Builtin; #[derive(Debug, PartialEq, Clone)] pub struct PrefixOp { - pub sigil: Rc, + sigil: Rc, pub builtin: Option, } impl PrefixOp { + #[allow(dead_code)] pub fn sigil(&self) -> &Rc { &self.sigil } diff --git a/schala-lang/language/src/eval.rs b/schala-lang/language/src/eval.rs index a17f9db..192f1f6 100644 --- a/schala-lang/language/src/eval.rs +++ b/schala-lang/language/src/eval.rs @@ -286,7 +286,8 @@ impl<'a> State<'a> { let evaled_args = evaled_args?; Ok(match (builtin, evaled_args.as_slice()) { - (FieldAccess, &[Node::PrimObject { ref name, ref tag, ref items }]) => { + (FieldAccess, &[Node::PrimObject { .. }]) => { + //TODO implement field access unimplemented!() }, (binop, &[Node::Expr(ref lhs), Node::Expr(ref rhs)]) => match (binop, lhs, rhs) { diff --git a/schala-lang/language/src/reduced_ast.rs b/schala-lang/language/src/reduced_ast.rs index b7d48dd..3669a9d 100644 --- a/schala-lang/language/src/reduced_ast.rs +++ b/schala-lang/language/src/reduced_ast.rs @@ -16,7 +16,7 @@ use std::rc::Rc; use std::str::FromStr; 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; #[derive(Debug)] @@ -194,7 +194,7 @@ fn reduce_lambda(params: &Vec, body: &Block, symbol_table: &SymbolT }) } -fn reduce_named_struct(fqsn: Option<&FullyQualifiedSymbolName>, name: &QualifiedName, fields: &Vec<(Rc, Meta)>, symbol_table: &SymbolTable) -> Expr { +fn reduce_named_struct(fqsn: Option<&FullyQualifiedSymbolName>, _name: &QualifiedName, fields: &Vec<(Rc, Meta)>, symbol_table: &SymbolTable) -> Expr { let sym_name = match fqsn { Some(fqsn) => fqsn, None => return Expr::ReductionError(format!("FQSN lookup for value B failed")), @@ -397,7 +397,7 @@ impl Pattern { } impl PatternLiteral { - fn to_subpattern(&self, symbol_table: &SymbolTable) -> Subpattern { + fn to_subpattern(&self, _symbol_table: &SymbolTable) -> Subpattern { use self::PatternLiteral::*; match self { NumPattern { neg, num } => { diff --git a/schala-lang/language/src/typechecking.rs b/schala-lang/language/src/typechecking.rs index 3f69291..89cb7cc 100644 --- a/schala-lang/language/src/typechecking.rs +++ b/schala-lang/language/src/typechecking.rs @@ -37,6 +37,7 @@ impl TypeError { } } +#[allow(dead_code)] // avoids warning from Compound #[derive(Debug, Clone, PartialEq)] pub enum Type { Const(TypeConst),