Skip to content

Commit

Permalink
Fix clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
antoyo committed Nov 9, 2024
1 parent 6798eaa commit 7ee332a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 27 deletions.
11 changes: 2 additions & 9 deletions tiger/src/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,12 @@
*/

use std::cmp::Ordering;
use std::collections::{BTreeMap, BTreeSet};
use std::collections::BTreeMap;
use std::rc::Rc;

use escape::{DepthEscape, EscapeEnv};
use frame::Frame;
use gen;
use gen::{Access, Level};
use gen::Access;
use position::WithPos;
use symbol::{
Strings,
Expand Down Expand Up @@ -62,10 +61,7 @@ impl Ord for ClosureField {
pub enum Entry<F: Clone + Frame> {
Fun {
external: bool,
is_normal_function: bool,
label: Label,
level: Level<F>,
escaping_vars: BTreeSet<ClosureField>,
parameters: Vec<Type>,
param_type_symbols: Vec<SymbolWithPos>,
result: Type,
Expand Down Expand Up @@ -126,10 +122,7 @@ impl<F: Clone + Frame> Env<F> {
let symbol = self.var_env.symbol(name);
let entry = Entry::Fun {
external: true,
is_normal_function: true,
label: Label::with_name(name),
level: gen::outermost(), // FIXME: Might want to create a new level.
escaping_vars: BTreeSet::new(),
parameters,
param_type_symbols: vec![],
result,
Expand Down
18 changes: 0 additions & 18 deletions tiger/src/semant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -333,16 +333,9 @@ impl<'a, F: Clone + Debug + Frame + PartialEq> SemanticAnalyzer<'a, F> {
}
levels.push(level.clone());

// escaping_vars contains the variables that escape and are defined in the
// outside scopes.
let escaping_vars = self.find_escaping_vars();

self.env.enter_var(func_symbol, Entry::Fun {
external: false,
is_normal_function: true,
label: Label::with_name(&func_name),
level,
escaping_vars,
parameters,
param_type_symbols,
result: result_type.clone(),
Expand Down Expand Up @@ -1079,17 +1072,6 @@ impl<'a, F: Clone + Debug + Frame + PartialEq> SemanticAnalyzer<'a, F> {
}
}

fn find_escaping_vars(&self) -> BTreeSet<ClosureField> {
if let Some(escaping_vars) = self.escaping_vars.last() {
escaping_vars.iter()
.cloned()
.collect()
}
else {
BTreeSet::new()
}
}

fn duplicate_param(&mut self, param: &FieldWithPos) {
let ident = self.env.var_name(param.node.name);
self.add_error(Error::DuplicateParam {
Expand Down

0 comments on commit 7ee332a

Please sign in to comment.