File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
src/com/annimon/ownlang/lib/modules/functions Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -10,17 +10,17 @@ public final class std_foreach implements Function {
10
10
public Value execute (Value ... args ) {
11
11
if (args .length != 2 ) return NumberValue .ZERO ;
12
12
13
- if (!( args [1 ] instanceof FunctionValue ) ) return NumberValue .ZERO ;
13
+ if (args [1 ]. type () != Types . FUNCTION ) return NumberValue .ZERO ;
14
14
final Function function = ((FunctionValue ) args [1 ]).getValue ();
15
15
final Value container = args [0 ];
16
- if (container instanceof ArrayValue ) {
16
+ if (container . type () == Types . ARRAY ) {
17
17
final ArrayValue array = (ArrayValue ) container ;
18
18
for (Value element : array ) {
19
19
function .execute (element );
20
20
}
21
21
return NumberValue .ZERO ;
22
22
}
23
- if (container instanceof MapValue ) {
23
+ if (container . type () == Types . MAP ) {
24
24
final MapValue map = (MapValue ) container ;
25
25
for (Map .Entry <Value , Value > element : map ) {
26
26
function .execute (element .getKey (), element .getValue ());
You can’t perform that action at this time.
0 commit comments