1
- use crate :: entity:: builtin_fn:: PureBuiltinFnEntity ;
1
+ use crate :: entity:: { builtin_fn:: PureBuiltinFnEntity , interactions :: InteractionKind } ;
2
2
3
3
use super :: { object:: create_object_prototype, Prototype } ;
4
4
5
5
pub fn create_array_prototype < ' a > ( ) -> Prototype < ' a > {
6
6
let mut prototype = create_object_prototype ( ) ;
7
7
8
8
prototype. insert ( "concat" , PureBuiltinFnEntity :: returns_array ( ) ) ;
9
- prototype. insert ( "copyWithin" , PureBuiltinFnEntity :: returns_unknown ( ) . mutates_this ( ) ) ;
9
+ prototype. insert (
10
+ "copyWithin" ,
11
+ PureBuiltinFnEntity :: returns_unknown ( ) . interaction_kind ( InteractionKind :: ArrayOp ) ,
12
+ ) ;
10
13
prototype. insert ( "entries" , PureBuiltinFnEntity :: returns_array ( ) ) ;
11
14
prototype. insert ( "every" , PureBuiltinFnEntity :: returns_boolean ( ) ) ;
12
- prototype. insert ( "fill" , PureBuiltinFnEntity :: returns_unknown ( ) . mutates_this ( ) ) ;
15
+ prototype. insert (
16
+ "fill" ,
17
+ PureBuiltinFnEntity :: returns_unknown ( ) . interaction_kind ( InteractionKind :: ArrayOp ) ,
18
+ ) ;
13
19
prototype. insert ( "filter" , PureBuiltinFnEntity :: returns_array ( ) ) ;
14
20
prototype. insert ( "find" , PureBuiltinFnEntity :: returns_unknown ( ) ) ;
15
21
prototype. insert ( "findIndex" , PureBuiltinFnEntity :: returns_number ( ) ) ;
@@ -24,17 +30,38 @@ pub fn create_array_prototype<'a>() -> Prototype<'a> {
24
30
prototype. insert ( "keys" , PureBuiltinFnEntity :: returns_unknown ( ) ) ;
25
31
prototype. insert ( "lastIndexOf" , PureBuiltinFnEntity :: returns_number ( ) ) ;
26
32
prototype. insert ( "map" , PureBuiltinFnEntity :: returns_array ( ) ) ;
27
- prototype. insert ( "pop" , PureBuiltinFnEntity :: returns_unknown ( ) . mutates_this ( ) ) ;
28
- prototype. insert ( "push" , PureBuiltinFnEntity :: returns_number ( ) . mutates_this ( ) ) ;
33
+ prototype. insert (
34
+ "pop" ,
35
+ PureBuiltinFnEntity :: returns_unknown ( ) . interaction_kind ( InteractionKind :: ArrayOp ) ,
36
+ ) ;
37
+ prototype. insert (
38
+ "push" ,
39
+ PureBuiltinFnEntity :: returns_number ( ) . interaction_kind ( InteractionKind :: ArrayOp ) ,
40
+ ) ;
29
41
prototype. insert ( "reduce" , PureBuiltinFnEntity :: returns_unknown ( ) ) ;
30
42
prototype. insert ( "reduceRight" , PureBuiltinFnEntity :: returns_unknown ( ) ) ;
31
- prototype. insert ( "reverse" , PureBuiltinFnEntity :: returns_unknown ( ) . mutates_this ( ) ) ;
32
- prototype. insert ( "shift" , PureBuiltinFnEntity :: returns_unknown ( ) . mutates_this ( ) ) ;
43
+ prototype. insert (
44
+ "reverse" ,
45
+ PureBuiltinFnEntity :: returns_unknown ( ) . interaction_kind ( InteractionKind :: ArrayOp ) ,
46
+ ) ;
47
+ prototype. insert (
48
+ "shift" ,
49
+ PureBuiltinFnEntity :: returns_unknown ( ) . interaction_kind ( InteractionKind :: ArrayOp ) ,
50
+ ) ;
33
51
prototype. insert ( "slice" , PureBuiltinFnEntity :: returns_array ( ) ) ;
34
52
prototype. insert ( "some" , PureBuiltinFnEntity :: returns_boolean ( ) ) ;
35
- prototype. insert ( "sort" , PureBuiltinFnEntity :: returns_unknown ( ) . mutates_this ( ) ) ;
36
- prototype. insert ( "splice" , PureBuiltinFnEntity :: returns_array ( ) . mutates_this ( ) ) ;
37
- prototype. insert ( "unshift" , PureBuiltinFnEntity :: returns_number ( ) . mutates_this ( ) ) ;
53
+ prototype. insert (
54
+ "sort" ,
55
+ PureBuiltinFnEntity :: returns_unknown ( ) . interaction_kind ( InteractionKind :: ArrayOp ) ,
56
+ ) ;
57
+ prototype. insert (
58
+ "splice" ,
59
+ PureBuiltinFnEntity :: returns_array ( ) . interaction_kind ( InteractionKind :: ArrayOp ) ,
60
+ ) ;
61
+ prototype. insert (
62
+ "unshift" ,
63
+ PureBuiltinFnEntity :: returns_number ( ) . interaction_kind ( InteractionKind :: ArrayOp ) ,
64
+ ) ;
38
65
prototype. insert ( "values" , PureBuiltinFnEntity :: returns_unknown ( ) ) ;
39
66
40
67
prototype
0 commit comments