From d8d9eb80876ab35a67e106a0717a93d6379abe50 Mon Sep 17 00:00:00 2001 From: Daniel Watkins Date: Fri, 10 Aug 2018 15:51:13 -0400 Subject: [PATCH] Silence a variety of unused argument warnings --- vm/src/builtins.rs | 3 ++- vm/src/compile.rs | 21 ++++++++++++++------- vm/src/objdict.rs | 8 +++++++- vm/src/objint.rs | 3 ++- vm/src/objlist.rs | 3 ++- vm/src/pyobject.rs | 2 +- vm/src/vm.rs | 2 +- 7 files changed, 29 insertions(+), 13 deletions(-) diff --git a/vm/src/builtins.rs b/vm/src/builtins.rs index b4663ddf8..2de1c9cff 100644 --- a/vm/src/builtins.rs +++ b/vm/src/builtins.rs @@ -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 } diff --git a/vm/src/compile.rs b/vm/src/compile.rs index b9fe4c291..7bc4b8509 100644 --- a/vm/src/compile.rs +++ b/vm/src/compile.rs @@ -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); diff --git a/vm/src/objdict.rs b/vm/src/objdict.rs index 3c1578bc0..0b5fbc443 100644 --- a/vm/src/objdict.rs +++ b/vm/src/objdict.rs @@ -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()) } diff --git a/vm/src/objint.rs b/vm/src/objint.rs index c818ad74e..ccf23a7d7 100644 --- a/vm/src/objint.rs +++ b/vm/src/objint.rs @@ -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 { +fn str(vm: &mut VirtualMachine, _args: PyFuncArgs) -> Result { + // TODO: Implement objint::str Ok(vm.new_str("todo".to_string())) } diff --git a/vm/src/objlist.rs b/vm/src/objlist.rs index 081bba021..67d075b33 100644 --- a/vm/src/objlist.rs +++ b/vm/src/objlist.rs @@ -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()) } diff --git a/vm/src/pyobject.rs b/vm/src/pyobject.rs index 10c6f5d8a..1a3174280 100644 --- a/vm/src/pyobject.rs +++ b/vm/src/pyobject.rs @@ -434,7 +434,7 @@ impl PyObject { PyObjectKind::Code { code: _ } => format!(""), PyObjectKind::Function { code: _, scope: _ } => format!(""), PyObjectKind::RustFunction { function: _ } => format!(""), - PyObjectKind::Module { ref name, ref dict } => format!("", name), + PyObjectKind::Module { ref name, dict: _ } => format!("", name), PyObjectKind::Scope { ref scope } => format!("", scope), PyObjectKind::Slice { ref start, diff --git a/vm/src/vm.rs b/vm/src/vm.rs index 8f0f5ad47..6f18094f7 100644 --- a/vm/src/vm.rs +++ b/vm/src/vm.rs @@ -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