@@ -72,7 +72,7 @@ fn builtin_any(vm: &mut VirtualMachine, args: PyFuncArgs) -> PyResult {
7272// builtin_callable
7373
7474fn builtin_chr ( vm : & mut VirtualMachine , args : PyFuncArgs ) -> PyResult {
75- arg_check ! ( vm, args, ( i, Some ( vm. ctx. int_type. clone( ) ) ) ) ;
75+ arg_check ! ( vm, args, required = [ ( i, Some ( vm. ctx. int_type. clone( ) ) ) ] ) ;
7676
7777 let code_point_obj = i. borrow ( ) ;
7878
@@ -95,7 +95,7 @@ fn builtin_chr(vm: &mut VirtualMachine, args: PyFuncArgs) -> PyResult {
9595// builtin_classmethod
9696
9797fn builtin_compile ( vm : & mut VirtualMachine , args : PyFuncArgs ) -> PyResult {
98- arg_check ! ( vm, args, ( source, None ) ) ;
98+ arg_check ! ( vm, args, required = [ ( source, None ) ] ) ;
9999 // TODO:
100100 let mode = compile:: Mode :: Eval ;
101101 let source = source. borrow ( ) . str ( ) ;
@@ -125,9 +125,11 @@ fn builtin_eval(vm: &mut VirtualMachine, args: PyFuncArgs) -> PyResult {
125125 arg_check ! (
126126 vm,
127127 args,
128- ( source, None ) , // TODO: Use more specific type
129- ( _globals, Some ( vm. ctx. dict_type. clone( ) ) ) ,
130- ( locals, Some ( vm. ctx. dict_type. clone( ) ) )
128+ required = [
129+ ( source, None ) , // TODO: Use more specific type
130+ ( _globals, Some ( vm. ctx. dict_type. clone( ) ) ) ,
131+ ( locals, Some ( vm. ctx. dict_type. clone( ) ) )
132+ ]
131133 ) ;
132134 // TODO: handle optional global and locals
133135
@@ -154,7 +156,11 @@ fn builtin_eval(vm: &mut VirtualMachine, args: PyFuncArgs) -> PyResult {
154156// builtin_frozenset
155157
156158fn builtin_getattr ( vm : & mut VirtualMachine , args : PyFuncArgs ) -> PyResult {
157- arg_check ! ( vm, args, ( obj, None ) , ( attr, Some ( vm. ctx. str_type. clone( ) ) ) ) ;
159+ arg_check ! (
160+ vm,
161+ args,
162+ required = [ ( obj, None ) , ( attr, Some ( vm. ctx. str_type. clone( ) ) ) ]
163+ ) ;
158164 if let PyObjectKind :: String { ref value } = attr. borrow ( ) . kind {
159165 vm. get_attribute ( obj. clone ( ) , value)
160166 } else {
@@ -165,7 +171,11 @@ fn builtin_getattr(vm: &mut VirtualMachine, args: PyFuncArgs) -> PyResult {
165171// builtin_globals
166172
167173fn builtin_hasattr ( vm : & mut VirtualMachine , args : PyFuncArgs ) -> PyResult {
168- arg_check ! ( vm, args, ( obj, None ) , ( attr, Some ( vm. ctx. str_type. clone( ) ) ) ) ;
174+ arg_check ! (
175+ vm,
176+ args,
177+ required = [ ( obj, None ) , ( attr, Some ( vm. ctx. str_type. clone( ) ) ) ]
178+ ) ;
169179 if let PyObjectKind :: String { ref value } = attr. borrow ( ) . kind {
170180 let has_attr = match vm. get_attribute ( obj. clone ( ) , value) {
171181 Ok ( ..) => true ,
@@ -182,7 +192,7 @@ fn builtin_hasattr(vm: &mut VirtualMachine, args: PyFuncArgs) -> PyResult {
182192// builtin_hex
183193
184194fn builtin_id ( vm : & mut VirtualMachine , args : PyFuncArgs ) -> PyResult {
185- arg_check ! ( vm, args, ( obj, None ) ) ;
195+ arg_check ! ( vm, args, required = [ ( obj, None ) ] ) ;
186196
187197 Ok ( vm. context ( ) . new_int ( obj. get_id ( ) as i32 ) )
188198}
@@ -191,7 +201,7 @@ fn builtin_id(vm: &mut VirtualMachine, args: PyFuncArgs) -> PyResult {
191201// builtin_int
192202
193203fn builtin_isinstance ( vm : & mut VirtualMachine , args : PyFuncArgs ) -> PyResult {
194- arg_check ! ( vm, args, ( obj, None ) , ( typ, None ) ) ;
204+ arg_check ! ( vm, args, required = [ ( obj, None ) , ( typ, None ) ] ) ;
195205
196206 let isinstance = objtype:: isinstance ( obj. clone ( ) , typ. clone ( ) ) ;
197207 Ok ( vm. context ( ) . new_bool ( isinstance) )
@@ -211,7 +221,7 @@ fn builtin_issubclass(vm: &mut VirtualMachine, args: PyFuncArgs) -> PyResult {
211221// builtin_iter
212222
213223fn builtin_len ( vm : & mut VirtualMachine , args : PyFuncArgs ) -> PyResult {
214- arg_check ! ( vm, args, ( obj, None ) ) ;
224+ arg_check ! ( vm, args, required = [ ( obj, None ) ] ) ;
215225 match obj. borrow ( ) . kind {
216226 PyObjectKind :: Dict { ref elements } => Ok ( vm. context ( ) . new_int ( elements. len ( ) as i32 ) ) ,
217227 PyObjectKind :: Tuple { ref elements } => Ok ( vm. context ( ) . new_int ( elements. len ( ) as i32 ) ) ,
@@ -262,7 +272,11 @@ pub fn builtin_print(vm: &mut VirtualMachine, args: PyFuncArgs) -> PyResult {
262272// builtin_property
263273
264274fn builtin_range ( vm : & mut VirtualMachine , args : PyFuncArgs ) -> PyResult {
265- arg_check ! ( vm, args, ( range, Some ( vm. ctx. int_type. clone( ) ) ) ) ;
275+ arg_check ! (
276+ vm,
277+ args,
278+ required = [ ( range, Some ( vm. ctx. int_type. clone( ) ) ) ]
279+ ) ;
266280 match range. borrow ( ) . kind {
267281 PyObjectKind :: Integer { ref value } => {
268282 let range_elements: Vec < PyObjectRef > =
@@ -282,9 +296,11 @@ fn builtin_setattr(vm: &mut VirtualMachine, args: PyFuncArgs) -> PyResult {
282296 arg_check ! (
283297 vm,
284298 args,
285- ( obj, None ) ,
286- ( attr, Some ( vm. ctx. str_type. clone( ) ) ) ,
287- ( value, None )
299+ required = [
300+ ( obj, None ) ,
301+ ( attr, Some ( vm. ctx. str_type. clone( ) ) ) ,
302+ ( value, None )
303+ ]
288304 ) ;
289305 if let PyObjectKind :: String { value : ref name } = attr. borrow ( ) . kind {
290306 obj. clone ( ) . set_attr ( name, value. clone ( ) ) ;
0 commit comments