if (paramVal instanceof TypedValue.ArgValue)
{
TypedValue.ArgValue paramArg = (TypedValue.ArgValue)paramVal;
int parentArgIndex = paramArg.getIndex();
if (parentArgumentScope == null)
throw new TypedValueVisitorException("Cannot find a parent scope to determine how to access as sublambda's parent parameters.");
// TODO: Right now, we need to be careful about the scope of parent lambdas. Since we only support
// limited usage of parameters for sublambdas, it's not a problem yet, but more complicated usages
// might be problematic. (Might have to pass additional parameteres to handleArg etc.)
return parentArgumentScope.handleArg(parentArgIndex, argType);
}
else if (paramVal instanceof TypedValue.GetFieldValue)
{
TypedValue.GetFieldValue paramArg = (TypedValue.GetFieldValue)paramVal;
String parentFieldName = paramArg.name;
if (parentArgumentScope == null)
throw new TypedValueVisitorException("Cannot find a parent scope to determine how to access as sublambda's parent parameters.");
// TODO: Right now, we need to be careful about the scope of parent lambdas. Since we only support
// limited usage of parameters for sublambdas, it's not a problem yet, but more complicated usages
// might be problematic. (Might have to pass additional parameteres to handleArg etc.)
return parentArgumentScope.handleThisFieldRead(parentFieldName, argType);
}
else
{
throw new TypedValueVisitorException("Jinq can only passthrough parent lambda parameters directly to sub-lambdas. Sublambdas cannot take parameters that involve computation.");
}
}