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;
}
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;
}
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);
}
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);
}
Aggregations