Silence a variety of unused argument warnings

This commit is contained in:
Daniel Watkins
2018-08-10 15:51:13 -04:00
parent 20737f77ac
commit d8d9eb8087
7 changed files with 29 additions and 13 deletions

View File

@@ -28,7 +28,8 @@ fn dir_locals(vm: &mut VirtualMachine) -> PyObjectRef {
get_locals(vm)
}
fn dir_object(vm: &mut VirtualMachine, obj: PyObjectRef) -> PyObjectRef {
fn dir_object(vm: &mut VirtualMachine, _obj: PyObjectRef) -> PyObjectRef {
// TODO: Implement dir for objects
let d = vm.new_dict();
d
}

View File

@@ -156,7 +156,12 @@ impl Compiler {
}
self.set_label(end_label);
}
ast::Statement::While { test, body, orelse } => {
ast::Statement::While {
test,
body,
orelse: _,
} => {
// TODO: Handle while-loop else clauses
let start_label = self.new_label();
let end_label = self.new_label();
self.emit(Instruction::SetupLoop {
@@ -173,15 +178,16 @@ impl Compiler {
});
self.set_label(end_label);
}
ast::Statement::With { items, body } => {
ast::Statement::With { items: _, body: _ } => {
// TODO
}
ast::Statement::For {
target,
iter,
body,
orelse,
orelse: _,
} => {
// TODO: Handle for loop else clauses
// The thing iterated:
for i in iter {
self.compile_expression(i);
@@ -347,8 +353,8 @@ impl Compiler {
self.compile_op(op);
self.compile_store(target);
}
ast::Statement::Delete { targets } => {
// Remove the given names from the scope
ast::Statement::Delete { targets: _ } => {
// TODO: Remove the given names from the scope
// self.emit(Instruction::DeleteName);
}
ast::Statement::Pass => {
@@ -409,8 +415,9 @@ impl Compiler {
self.compile_test(b, not_label);
}
ast::BooleanOperator::Or => {
// TODO: Implement boolean or
// TODO: implement short circuit code by fiddeling with the labels
let end_label1 = self.new_label();
self.new_label();
self.compile_test(a, not_label);
self.compile_test(b, not_label);
panic!("Not impl");
@@ -437,7 +444,7 @@ impl Compiler {
}
self.emit(Instruction::CallFunction { count: count });
}
ast::Expression::BoolOp { a, op, b } => {
ast::Expression::BoolOp { a: _, op: _, b: _ } => {
let not_label = self.new_label();
let end_label = self.new_label();
self.compile_test(expression, not_label);

View File

@@ -1,7 +1,13 @@
use super::pyobject::{PyObjectRef, PyResult};
use super::vm::VirtualMachine;
pub fn set_item(vm: &mut VirtualMachine, d: PyObjectRef, idx: PyObjectRef, obj: PyObjectRef) -> PyResult {
pub fn set_item(
vm: &mut VirtualMachine,
_d: PyObjectRef,
_idx: PyObjectRef,
_obj: PyObjectRef,
) -> PyResult {
// TODO: Implement objdict::set_item
Ok(vm.get_none())
}

View File

@@ -2,7 +2,8 @@ use super::pyobject::{PyObject, PyObjectKind, PyObjectRef, PyFuncArgs};
use super::vm::VirtualMachine;
use std::collections::HashMap;
fn str(vm: &mut VirtualMachine, args: PyFuncArgs) -> Result<PyObjectRef, PyObjectRef> {
fn str(vm: &mut VirtualMachine, _args: PyFuncArgs) -> Result<PyObjectRef, PyObjectRef> {
// TODO: Implement objint::str
Ok(vm.new_str("todo".to_string()))
}

View File

@@ -22,7 +22,8 @@ pub fn set_item(
}
}
pub fn append(vm: &mut VirtualMachine, l: PyObjectRef, other: PyObjectRef) -> PyResult {
pub fn append(vm: &mut VirtualMachine, _l: PyObjectRef, _other: PyObjectRef) -> PyResult {
// TODO: Implement objlist::append
Ok(vm.get_none())
}

View File

@@ -434,7 +434,7 @@ impl PyObject {
PyObjectKind::Code { code: _ } => format!("<code>"),
PyObjectKind::Function { code: _, scope: _ } => format!("<func>"),
PyObjectKind::RustFunction { function: _ } => format!("<rustfunc>"),
PyObjectKind::Module { ref name, ref dict } => format!("<module '{}'>", name),
PyObjectKind::Module { ref name, dict: _ } => format!("<module '{}'>", name),
PyObjectKind::Scope { ref scope } => format!("<scope '{:?}'>", scope),
PyObjectKind::Slice {
ref start,

View File

@@ -686,7 +686,7 @@ impl VirtualMachine {
None
}
bytecode::Instruction::MakeFunction => {
let qualified_name = self.pop_value();
let _qualified_name = self.pop_value();
let code_obj = self.pop_value();
// pop argc arguments
// argument: name, args, globals