From 1fd2dd8e87f166831a15947c25f8443b6269bc80 Mon Sep 17 00:00:00 2001 From: Victor Date: Sat, 9 Jan 2016 15:06:25 +0200 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B0=20=D0=BF=D1=80=D0=BE=D0=B2=D0=B5=D1=80=D0=BA?= =?UTF-8?q?=D0=B0=20=D1=82=D0=B8=D0=BF=D0=BE=D0=B2=20=D0=B2=20=D1=84=D1=83?= =?UTF-8?q?=D0=BD=D0=BA=D1=86=D0=B8=D0=B8=20foreach?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../annimon/ownlang/lib/modules/functions/std_foreach.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/com/annimon/ownlang/lib/modules/functions/std_foreach.java b/src/com/annimon/ownlang/lib/modules/functions/std_foreach.java index eac4b96..dfb7493 100644 --- a/src/com/annimon/ownlang/lib/modules/functions/std_foreach.java +++ b/src/com/annimon/ownlang/lib/modules/functions/std_foreach.java @@ -10,17 +10,17 @@ public final class std_foreach implements Function { public Value execute(Value... args) { if (args.length != 2) return NumberValue.ZERO; - if (!(args[1] instanceof FunctionValue)) return NumberValue.ZERO; + if (args[1].type() != Types.FUNCTION) return NumberValue.ZERO; final Function function = ((FunctionValue) args[1]).getValue(); final Value container = args[0]; - if (container instanceof ArrayValue) { + if (container.type() == Types.ARRAY) { final ArrayValue array = (ArrayValue) container; for (Value element : array) { function.execute(element); } return NumberValue.ZERO; } - if (container instanceof MapValue) { + if (container.type() == Types.MAP) { final MapValue map = (MapValue) container; for (Map.Entry element : map) { function.execute(element.getKey(), element.getValue());