Gave Clippy some love
This commit is contained in:
parent
3861062565
commit
c36bcf5bc9
4 changed files with 6 additions and 9 deletions
|
@ -105,7 +105,7 @@ fn dump_statement(dumper: &mut Dumper, stmt: &StmtNode) {
|
||||||
if !decl.members.is_empty() {
|
if !decl.members.is_empty() {
|
||||||
dumper.depth += 1;
|
dumper.depth += 1;
|
||||||
for member in decl.members.iter() {
|
for member in decl.members.iter() {
|
||||||
dump_member(dumper, &member);
|
dump_member(dumper, member);
|
||||||
}
|
}
|
||||||
dumper.depth -= 1;
|
dumper.depth -= 1;
|
||||||
dumper.add_line(String::default());
|
dumper.add_line(String::default());
|
||||||
|
|
|
@ -161,7 +161,7 @@ where
|
||||||
{
|
{
|
||||||
let mut cls = class.clone();
|
let mut cls = class.clone();
|
||||||
loop {
|
loop {
|
||||||
if let Some(member) = cls.borrow().members.get(&mb_key) {
|
if let Some(member) = cls.borrow().members.get(mb_key) {
|
||||||
return Some(f(member));
|
return Some(f(member));
|
||||||
}
|
}
|
||||||
let nclr = if let Some(sc) = &cls.borrow().superclass {
|
let nclr = if let Some(sc) = &cls.borrow().superclass {
|
||||||
|
|
|
@ -282,10 +282,7 @@ fn on_class_decl(es: &mut InterpreterState, decl: &ClassDecl) -> InterpreterResu
|
||||||
return error(&superclass.token, "superclass must be a class");
|
return error(&superclass.token, "superclass must be a class");
|
||||||
};
|
};
|
||||||
let mut sub_env = InterpreterState::create_child(es);
|
let mut sub_env = InterpreterState::create_child(es);
|
||||||
sub_env
|
sub_env.environment.borrow_mut().set("super", sc_value);
|
||||||
.environment
|
|
||||||
.borrow_mut()
|
|
||||||
.set("super", sc_value.clone());
|
|
||||||
Class::new(
|
Class::new(
|
||||||
decl.name.lexeme.clone(),
|
decl.name.lexeme.clone(),
|
||||||
sc_ref,
|
sc_ref,
|
||||||
|
@ -584,7 +581,7 @@ fn on_super(itpr_state: &mut InterpreterState, super_expr: &SuperExpr) -> Interp
|
||||||
)?;
|
)?;
|
||||||
Ok(obj_ref
|
Ok(obj_ref
|
||||||
.with_property_carrier(
|
.with_property_carrier(
|
||||||
|inst| inst.get_super(itpr_state, &super_expr, distance),
|
|inst| inst.get_super(itpr_state, super_expr, distance),
|
||||||
|| panic!("'this' didn't contain an instance"),
|
|| panic!("'this' didn't contain an instance"),
|
||||||
)?
|
)?
|
||||||
.into())
|
.into())
|
||||||
|
|
|
@ -228,7 +228,7 @@ impl Parser {
|
||||||
let superclass = match self.expect(&[TokenType::Less]) {
|
let superclass = match self.expect(&[TokenType::Less]) {
|
||||||
None => None,
|
None => None,
|
||||||
Some(_) => Some(VariableExpr {
|
Some(_) => Some(VariableExpr {
|
||||||
token: self.consume_identifier("expected superclass name")?.clone(),
|
token: self.consume_identifier("expected superclass name")?,
|
||||||
id: self.make_id(),
|
id: self.make_id(),
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
@ -336,7 +336,7 @@ impl Parser {
|
||||||
/// block := "{" block_contents
|
/// block := "{" block_contents
|
||||||
/// ```
|
/// ```
|
||||||
fn parse_block(&mut self, err_string: &str) -> Result<StmtNode, SloxError> {
|
fn parse_block(&mut self, err_string: &str) -> Result<StmtNode, SloxError> {
|
||||||
self.consume(&TokenType::LeftBrace, &err_string)?;
|
self.consume(&TokenType::LeftBrace, err_string)?;
|
||||||
self.loop_state.push(LoopParsingState::None);
|
self.loop_state.push(LoopParsingState::None);
|
||||||
let result = self.parse_block_contents();
|
let result = self.parse_block_contents();
|
||||||
self.loop_state.pop();
|
self.loop_state.pop();
|
||||||
|
|
Loading…
Reference in a new issue