davsclaus commented on code in PR #27525:
URL: https://github.com/apache/camel/pull/27525#discussion_r4215824735
##########
components/camel-javascript/src/main/java/org/apache/camel/language/js/JavaScriptExpression.java:
##########
@@ -34,6 +41,7 @@ public JavaScriptExpression(String expressionString, Class<?>
type) {
JavaScriptExpression(String expressionString, Class<?> type,
JavaScriptLanguage language) {
this.expressionString = expressionString;
this.type = type;
+ this.bindVariables = expressionString != null &&
expressionString.contains("variable");
Review Comment:
Here (and in `PythonExpression.java:44` / `Python3Expression.java:41`) the
binding depends on the script text containing `variable`. Groovy and Jactl bind
`exchange.getVariables()` unconditionally (see
`ExchangeHelper.populateVariableMap`), so binding always would be consistent
and cannot miss an indirect lookup. If the variable-store allocation is the
concern, quickjs's `exchange.hasVariables() ? exchange.getVariables() :
Map.of()` avoids it, at the cost of a read-only empty map when no variables
exist yet.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]