File tree Expand file tree Collapse file tree 2 files changed +2
-28
lines changed Expand file tree Collapse file tree 2 files changed +2
-28
lines changed Original file line number Diff line number Diff line change @@ -181,15 +181,9 @@ impl Array {
181
181
182
182
/// Transform each item in the array with a function.
183
183
pub fn map ( & self , vm : & mut Vm , func : Func ) -> SourceResult < Self > {
184
- let enumerate = func. argc ( ) == Some ( 2 ) ;
185
184
self . iter ( )
186
- . enumerate ( )
187
- . map ( |( i, item) | {
188
- let mut args = Args :: new ( func. span ( ) , [ ] ) ;
189
- if enumerate {
190
- args. push ( func. span ( ) , Value :: Int ( i as i64 ) ) ;
191
- }
192
- args. push ( func. span ( ) , item. clone ( ) ) ;
185
+ . map ( |item| {
186
+ let args = Args :: new ( func. span ( ) , [ item. clone ( ) ] ) ;
193
187
func. call_vm ( vm, args)
194
188
} )
195
189
. collect ( )
Original file line number Diff line number Diff line change @@ -73,17 +73,6 @@ impl Func {
73
73
self
74
74
}
75
75
76
- /// The number of positional arguments this function takes, if known.
77
- pub fn argc ( & self ) -> Option < usize > {
78
- match & self . repr {
79
- Repr :: Closure ( closure) => closure. argc ( ) ,
80
- Repr :: With ( arc) => Some ( arc. 0 . argc ( ) ?. saturating_sub (
81
- arc. 1 . items . iter ( ) . filter ( |arg| arg. name . is_none ( ) ) . count ( ) ,
82
- ) ) ,
83
- _ => None ,
84
- }
85
- }
86
-
87
76
/// Call the function with the given arguments.
88
77
pub fn call_vm ( & self , vm : & mut Vm , mut args : Args ) -> SourceResult < Value > {
89
78
match & self . repr {
@@ -346,15 +335,6 @@ impl Closure {
346
335
347
336
result
348
337
}
349
-
350
- /// The number of positional arguments this closure takes, if known.
351
- fn argc ( & self ) -> Option < usize > {
352
- if self . sink . is_some ( ) {
353
- return None ;
354
- }
355
-
356
- Some ( self . params . iter ( ) . filter ( |( _, default) | default. is_none ( ) ) . count ( ) )
357
- }
358
338
}
359
339
360
340
impl From < Closure > for Func {
You can’t perform that action at this time.
0 commit comments