You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Dmitri Blinov (JIRA)" <ji...@apache.org> on 2016/03/16 10:15:33 UTC
[jira] [Commented] (JEXL-190) local function within context is not
resolved if function resolver class without namespace is specified
[ https://issues.apache.org/jira/browse/JEXL-190?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15197073#comment-15197073 ]
Dmitri Blinov commented on JEXL-190:
------------------------------------
As far as I can understand the logic the problem lies in Interpreter.java
{code}
protected Object visit(ASTFunctionNode node, Object data) {
int argc = node.jjtGetNumChildren();
if (argc == 2) {
Object namespace = resolveNamespace(null, node);
if (namespace == null) {
namespace = context;
}
ASTIdentifier functionNode = (ASTIdentifier) node.jjtGetChild(0);
ASTArguments argNode = (ASTArguments) node.jjtGetChild(1);
return call(node, namespace, functionNode, argNode);
{code}
if we initialized JexlEngine with namespace resolver map containing 'null' key, then JexlContext is never checked as it is only checked if there is nothing returned by resolveNamespace. So even if a variable in the context exists with that name, it will never be evaluated.
> local function within context is not resolved if function resolver class without namespace is specified
> -------------------------------------------------------------------------------------------------------
>
> Key: JEXL-190
> URL: https://issues.apache.org/jira/browse/JEXL-190
> Project: Commons JEXL
> Issue Type: Bug
> Affects Versions: 3.0
> Reporter: Dmitri Blinov
> Assignee: Henri Biestro
>
> {code}
> z = function(x) { return x + 1}; return z(1)
> {code} returns error unsolvable function/method 'z' while
> {code}
> var z = function(x) { return x + 1}; return z(1)
> {code} returns 2
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)