Search in sources :

Example 6 with Undefined

use of lucee.runtime.type.scope.Undefined in project Lucee by lucee.

the class QueryColumnImpl method getChildElement.

private Object getChildElement(PageContext pc, Key key, Object defaultValue) {
    // column and query has same name
    if (key.equals(this.key)) {
        return query.get(key, defaultValue);
    }
    // get it from undefined scope
    pc = ThreadLocalPageContext.get(pc);
    if (pc != null) {
        Undefined undefined = pc.undefinedScope();
        boolean old = undefined.setAllowImplicidQueryCall(false);
        Object sister = undefined.get(this.key, NullSupportHelper.NULL(pc));
        undefined.setAllowImplicidQueryCall(old);
        if (sister != NullSupportHelper.NULL(pc)) {
            try {
                return pc.get(sister, key);
            } catch (PageException e) {
                return defaultValue;
            }
        }
    }
    return defaultValue;
}
Also used : Undefined(lucee.runtime.type.scope.Undefined) PageException(lucee.runtime.exp.PageException) SerializableObject(lucee.commons.lang.SerializableObject)

Example 7 with Undefined

use of lucee.runtime.type.scope.Undefined in project Lucee by lucee.

the class SimpleQueryColumn method getChildElement.

private Object getChildElement(Key key, Object defaultValue) {
    PageContext pc = ThreadLocalPageContext.get();
    // column and query has same name
    if (key.equals(this.key)) {
        return get(qry.getCurrentrow(pc.getId()), defaultValue);
    }
    // get it from undefined scope
    if (pc != null) {
        Undefined undefined = pc.undefinedScope();
        boolean old = undefined.setAllowImplicidQueryCall(false);
        Object sister = undefined.get(this.key, null);
        undefined.setAllowImplicidQueryCall(old);
        if (sister != null) {
            try {
                return pc.get(sister, key);
            } catch (PageException e) {
                return defaultValue;
            }
        }
    }
    return defaultValue;
}
Also used : Undefined(lucee.runtime.type.scope.Undefined) PageException(lucee.runtime.exp.PageException) PageContext(lucee.runtime.PageContext) ThreadLocalPageContext(lucee.runtime.engine.ThreadLocalPageContext)

Example 8 with Undefined

use of lucee.runtime.type.scope.Undefined in project Lucee by lucee.

the class PageContextImpl method clearCatch.

@Override
public void clearCatch() {
    exception = null;
    Undefined u = undefinedScope();
    (u.getCheckArguments() ? u.localScope() : u).removeEL(KeyConstants._cfcatch);
}
Also used : Undefined(lucee.runtime.type.scope.Undefined)

Example 9 with Undefined

use of lucee.runtime.type.scope.Undefined in project Lucee by lucee.

the class VariableInterpreter method _variable.

public static Object _variable(PageContext pc, String str, Object value, Scope scope) throws PageException {
    // define a ohter enviroment for the function
    if (scope != null) {
        // Variables Scope
        Variables var = null;
        if (scope instanceof Variables) {
            var = (Variables) scope;
        } else if (scope instanceof CallerImpl) {
            var = ((CallerImpl) scope).getVariablesScope();
        }
        if (var != null) {
            Variables current = pc.variablesScope();
            pc.setVariablesScope(var);
            try {
                if (value != NULL)
                    return setVariable(pc, str, value);
                return getVariable(pc, str);
            } finally {
                pc.setVariablesScope(current);
            }
        } else // Undefined Scope
        if (scope instanceof Undefined) {
            PageContextImpl pci = (PageContextImpl) pc;
            Undefined undefined = (Undefined) scope;
            boolean check = undefined.getCheckArguments();
            Variables orgVar = pc.variablesScope();
            Argument orgArgs = pc.argumentsScope();
            Local orgLocal = pc.localScope();
            pci.setVariablesScope(undefined.variablesScope());
            if (check)
                pci.setFunctionScopes(undefined.localScope(), undefined.argumentsScope());
            try {
                if (value != NULL)
                    return setVariable(pc, str, value);
                return getVariable(pc, str);
            } finally {
                pc.setVariablesScope(orgVar);
                if (check)
                    pci.setFunctionScopes(orgLocal, orgArgs);
            }
        }
    }
    if (value != NULL)
        return setVariable(pc, str, value);
    return getVariable(pc, str);
}
Also used : Variables(lucee.runtime.type.scope.Variables) Undefined(lucee.runtime.type.scope.Undefined) CallerImpl(lucee.runtime.type.scope.CallerImpl) Argument(lucee.runtime.type.scope.Argument) Local(lucee.runtime.type.scope.Local) PageContextImpl(lucee.runtime.PageContextImpl)

Aggregations

Undefined (lucee.runtime.type.scope.Undefined)9 PageContextImpl (lucee.runtime.PageContextImpl)4 Argument (lucee.runtime.type.scope.Argument)4 Local (lucee.runtime.type.scope.Local)4 PageException (lucee.runtime.exp.PageException)3 Key (lucee.runtime.type.Collection.Key)3 Variables (lucee.runtime.type.scope.Variables)3 Entry (java.util.Map.Entry)2 PageContext (lucee.runtime.PageContext)2 ThreadLocalPageContext (lucee.runtime.engine.ThreadLocalPageContext)2 CallerImpl (lucee.runtime.type.scope.CallerImpl)2 LocalImpl (lucee.runtime.type.scope.LocalImpl)2 ArrayList (java.util.ArrayList)1 BodyContent (javax.servlet.jsp.tagext.BodyContent)1 DevNullOutputStream (lucee.commons.io.DevNullOutputStream)1 Log (lucee.commons.io.log.Log)1 Pair (lucee.commons.lang.Pair)1 SerializableObject (lucee.commons.lang.SerializableObject)1 Page (lucee.runtime.Page)1 PageSource (lucee.runtime.PageSource)1