This repository was archived by the owner on Jan 20, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +8
-8
lines changed
main/kotlin/com/mapk/fastkfunction/argumentbucket
test/kotlin/com/mapk/fastkfunction/fastkfunction Expand file tree Collapse file tree 3 files changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -18,21 +18,21 @@ class ArgumentBucket(
18
18
19
19
fun getValueArray (): Array <Any ?> = valueArrayGetter(valueArray)
20
20
21
- fun put (key : KParameter , value : Any? ): Any? {
21
+ operator fun set (key : KParameter , value : Any? ): Any? {
22
22
return valueArray[key.index].apply {
23
23
valueArray[key.index] = value
24
24
initializationStatuses[key.index] = true
25
25
}
26
26
}
27
27
28
- fun put (index : Int , value : Any? ): Any? {
28
+ operator fun set (index : Int , value : Any? ): Any? {
29
29
return valueArray[index].apply {
30
30
valueArray[index] = value
31
31
initializationStatuses[index] = true
32
32
}
33
33
}
34
34
35
- fun putIfAbsent (key : KParameter , value : Any? ): Any? {
35
+ fun setIfAbsent (key : KParameter , value : Any? ): Any? {
36
36
return if (initializationStatuses[key.index])
37
37
valueArray[key.index]
38
38
else
@@ -42,7 +42,7 @@ class ArgumentBucket(
42
42
}
43
43
}
44
44
45
- fun putIfAbsent (index : Int , value : Any? ): Any? {
45
+ fun setIfAbsent (index : Int , value : Any? ): Any? {
46
46
return if (initializationStatuses[index])
47
47
valueArray[index]
48
48
else
Original file line number Diff line number Diff line change @@ -53,8 +53,8 @@ private class FullInitializedCallTest {
53
53
val bucket = sut.generateBucket().apply {
54
54
val params = target.parameters.filter { it.kind == KParameter .Kind .VALUE }
55
55
56
- put (params[0 ], 100 )
57
- put (params[1 ], " txt" )
56
+ set (params[0 ], 100 )
57
+ set (params[1 ], " txt" )
58
58
}
59
59
60
60
assertDoesNotThrow(" Fail $message " ) {
Original file line number Diff line number Diff line change @@ -95,8 +95,8 @@ private class UseDefaultValueCallTest {
95
95
val bucket = sut.generateBucket().apply {
96
96
val params = target.parameters.filter { it.kind == KParameter .Kind .VALUE && ! it.isOptional }
97
97
98
- put (params[0 ], 100 )
99
- put (params[1 ], " txt" )
98
+ set (params[0 ], 100 )
99
+ set (params[1 ], " txt" )
100
100
}
101
101
102
102
assertDoesNotThrow(" Fail ${default.name} " ) {
You can’t perform that action at this time.
0 commit comments