Search in sources :

Example 1 with IdFunctionObject

use of org.mozilla.javascript.IdFunctionObject in project sling by apache.

the class SlingGlobal method init.

public static void init(Scriptable scope, boolean sealed) {
    SlingGlobal obj = new SlingGlobal();
    for (int id = 1; id <= LAST_SCOPE_FUNCTION_ID; ++id) {
        String name;
        int arity = 1;
        switch(id) {
            case Id_load:
                name = "load";
                break;
            case Id_print:
                name = "print";
                break;
            case Id_require:
                name = "require";
                break;
            default:
                throw Kit.codeBug();
        }
        IdFunctionObject f = new IdFunctionObject(obj, FTAG, id, name, arity, scope);
        if (sealed) {
            f.sealObject();
        }
        f.exportAsScopeProperty();
    }
}
Also used : IdFunctionObject(org.mozilla.javascript.IdFunctionObject)

Aggregations

IdFunctionObject (org.mozilla.javascript.IdFunctionObject)1