From 8896b1a7a75a57a40ed87776b167244b76c29cc6 Mon Sep 17 00:00:00 2001 From: Greg Shuflin Date: Tue, 26 Oct 2021 14:34:51 -0700 Subject: [PATCH] Kill old comments --- schala-lang/language/src/reduced_ir/mod.rs | 190 --------------------- 1 file changed, 190 deletions(-) diff --git a/schala-lang/language/src/reduced_ir/mod.rs b/schala-lang/language/src/reduced_ir/mod.rs index 7ae7269..8a37360 100644 --- a/schala-lang/language/src/reduced_ir/mod.rs +++ b/schala-lang/language/src/reduced_ir/mod.rs @@ -362,193 +362,3 @@ impl ast::Pattern { }) } } - -/* -impl ast::Pattern { - fn to_subpattern(&self, symbol_table: &SymbolTable) -> Subpattern { - use ast::Pattern::*; - use Expression::ReductionError; - - match self { - Ignored => Subpattern { - tag: None, - subpatterns: vec![], - guard: None, - }, - Literal(lit) => lit.to_subpattern(symbol_table), - /* - TupleStruct(QualifiedName { components, id }, inner_patterns) => { - match symbol_table.lookup_symbol(id) { - Some(symbol) => handle_symbol(Some(symbol), inner_patterns, symbol_table), - None => panic!("Symbol {:?} not found", components), - } - } - */ - _ => Subpattern { - tag: None, - subpatterns: vec![], - guard: None, - } - } - /* - TuplePattern(inner_patterns) => handle_symbol(None, inner_patterns, symbol_table), - Record(_name, _pairs) => { - unimplemented!() - } - VarOrName(QualifiedName { components, id }) => { - // if symbol is Some, treat this as a symbol pattern. If it's None, treat it - // as a variable. - match symbol_table.lookup_symbol(id) { - Some(symbol) => handle_symbol(Some(symbol), &[], symbol_table), - None => { - println!("Components: {:?}", components); - let name = if components.len() == 1 { - components[0].clone() - } else { - panic!("check this line of code yo"); - }; - Subpattern { - tag: None, - subpatterns: vec![], - guard: None, - bound_vars: vec![Some(name)], - } - } - } - } - */ - } -} -*/ - -/* -fn handle_symbol( - symbol: Option<&Symbol>, - inner_patterns: &[Pattern], - symbol_table: &SymbolTable, -) -> Subpattern { - use ast::Pattern::*; - - let tag = symbol.map(|symbol| match symbol.spec { - SymbolSpec::DataConstructor { index, .. } => index, - _ => { - panic!("Symbol is not a data constructor - this should've been caught in type-checking") - } - }); - let bound_vars = inner_patterns - .iter() - .map(|p| match p { - VarOrName(qualified_name) => { - let symbol_exists = symbol_table.lookup_symbol(&qualified_name.id).is_some(); - if symbol_exists { - None - } else { - let QualifiedName { components, .. } = qualified_name; - if components.len() == 1 { - Some(components[0].clone()) - } else { - panic!("Bad variable name in pattern"); - } - } - } - _ => None, - }) - .collect(); - - let subpatterns = inner_patterns - .iter() - .map(|p| match p { - Ignored => None, - VarOrName(_) => None, - Literal(other) => Some(other.to_subpattern(symbol_table)), - tp @ TuplePattern(_) => Some(tp.to_subpattern(symbol_table)), - ts @ TupleStruct(_, _) => Some(ts.to_subpattern(symbol_table)), - Record(..) => unimplemented!(), - }) - .collect(); - - let guard = None; - /* - let guard_equality_exprs: Vec = subpatterns.iter().map(|p| match p { - Literal(lit) => match lit { - _ => unimplemented!() - }, - _ => unimplemented!() - }).collect(); - */ - - Subpattern { - tag, - subpatterns, - guard, - bound_vars, - } -} -*/ - -/* -impl ast::PatternLiteral { - fn to_subpattern(&self, _symbol_table: &SymbolTable) -> Subpattern { - use ast::PatternLiteral::*; - - match self { - NumPattern { neg, num } => { - let comparison = Expression::Literal(match (neg, num) { - (false, ast::ExpressionKind::NatLiteral(n)) => Literal::Nat(*n), - (false, ast::ExpressionKind::FloatLiteral(f)) => Literal::Float(*f), - (true, ast::ExpressionKind::NatLiteral(n)) => Literal::Int(-(*n as i64)), - (true, ast::ExpressionKind::FloatLiteral(f)) => Literal::Float(-f), - _ => panic!("This should never happen"), - }); - unimplemented!() - /* - let guard = Some(Expr::Call { - f: Box::new(Expr::Func(Func::BuiltIn(Builtin::Equality))), - args: vec![comparison, Expr::ConditionalTargetSigilValue], - }); - Subpattern { - tag: None, - subpatterns: vec![], - guard, - } - */ - } - _ => unimplemented!() - /* - StringPattern(s) => { - let guard = Some(Expr::Call { - f: Box::new(Expr::Func(Func::BuiltIn(Builtin::Equality))), - args: vec![ - Expr::Lit(Lit::StringLit(s.clone())), - Expr::ConditionalTargetSigilValue, - ], - }); - - Subpattern { - tag: None, - subpatterns: vec![], - guard, - bound_vars: vec![], - } - } - BoolPattern(b) => { - let guard = Some(if *b { - Expr::ConditionalTargetSigilValue - } else { - Expr::Call { - f: Box::new(Expr::Func(Func::BuiltIn(Builtin::BooleanNot))), - args: vec![Expr::ConditionalTargetSigilValue], - } - }); - Subpattern { - tag: None, - subpatterns: vec![], - guard, - bound_vars: vec![], - } - } - */ - } - } -} -*/