Skip to content

Commit

Permalink
Reformat.
Browse files Browse the repository at this point in the history
  • Loading branch information
ltratt committed Jun 10, 2020
1 parent f57c74b commit 735b752
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/lib/compiler/ast_to_instrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,18 @@ impl<'a, 'input> Compiler<'a, 'input> {
let vars_len = inst_vars.len();
let n = lexer.span_str(*var).to_owned();
match inst_vars.entry(n) {
hash_map::Entry::Occupied(_) => return Err(vec![(*var, format!("Field '{}' has already been defined in this class.", self.lexer.span_str(*var)))]),
hash_map::Entry::Vacant(e) => { e.insert(vars_len); }
hash_map::Entry::Occupied(_) => {
return Err(vec![(
*var,
format!(
"Field '{}' has already been defined in this class.",
self.lexer.span_str(*var)
),
)])
}
hash_map::Entry::Vacant(e) => {
e.insert(vars_len);
}
}
}
self.vars_stack.push(inst_vars);
Expand Down

0 comments on commit 735b752

Please sign in to comment.