aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/zwobble/couscous/interpreter/values/InternalCouscousInterpeterValue.java
blob: e8b358f6fab9a30fe98981c4af27bce0110d3844 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package org.zwobble.couscous.interpreter.values;

import org.zwobble.couscous.values.BooleanValue;
import org.zwobble.couscous.values.IntegerValue;
import org.zwobble.couscous.values.ObjectValues;

import static java.util.Arrays.asList;

public class InternalCouscousInterpeterValue {
    public static final ConcreteType TYPE = ConcreteType.classBuilder("_couscous")
        .staticMethod("same", asList(ObjectValues.OBJECT, ObjectValues.OBJECT),
            (environment, arguments) ->
                new BooleanInterpreterValue(arguments.get(0) == arguments.get(1)))

        .staticMethod("boxBoolean", asList(BooleanValue.REF),
            ((environment, arguments) ->  arguments.get(0)))

        .staticMethod("boxInt", asList(IntegerValue.REF),
            ((environment, arguments) ->  arguments.get(0)))

        .build();
}