Skip to content

Conversation

@bentsherman
Copy link
Member

Close #6695

This PR updates the strict parser to collect references to task.ext.* so that they are added to the task hash (docs).

I originally thought to move the VariableVisitor into nf-lang so that it is re-used by both, but I think this visitor does a lot of unnecessary work, and I didn't want to alter the old parser too much, so I just created a separate implementation for the strict parser that is much simpler. It only collects references to task.ext.* instead of all variable references.

Note to self: once we make the strict parser the default (#6643), we should revisit the runtime layer and how it handles these variable references. I think it could be simplified quite a bit.

@bentsherman bentsherman requested a review from jorgee December 31, 2025 16:33
@bentsherman bentsherman requested a review from a team as a code owner December 31, 2025 16:33
@netlify
Copy link

netlify bot commented Dec 31, 2025

Deploy Preview for nextflow-docs-staging canceled.

Name Link
🔨 Latest commit bd9a691
🔍 Latest deploy log https://app.netlify.com/projects/nextflow-docs-staging/deploys/695550424513e50008798dd2

Comment on lines +98 to +113
private static String asPropertyChain(PropertyExpression node) {
var builder = new StringBuilder();
builder.append(node.getPropertyAsString());

var target = node.getObjectExpression();
while( target instanceof PropertyExpression pe ) {
builder.append('.');
builder.append(pe.getPropertyAsString());
target = pe.getObjectExpression();
}

builder.append('.');
builder.append(target.getText());

return builder.reverse().toString();
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reverse in last statement is reversing the full stringbuilder getting something like ksat.txe.sgra. I think you wanted to just reverse the order of elements of a list of strings and join with . later.

Suggested change
private static String asPropertyChain(PropertyExpression node) {
var builder = new StringBuilder();
builder.append(node.getPropertyAsString());
var target = node.getObjectExpression();
while( target instanceof PropertyExpression pe ) {
builder.append('.');
builder.append(pe.getPropertyAsString());
target = pe.getObjectExpression();
}
builder.append('.');
builder.append(target.getText());
return builder.reverse().toString();
}
private static String asPropertyChain(PropertyExpression node) {
var list = new ArrayList<String>();
list.add(node.getPropertyAsString());
var target = node.getObjectExpression();
while( target instanceof PropertyExpression pe ) {
list.add(pe.getPropertyAsString());
target = pe.getObjectExpression();
}
list.add(target.getText());
Collections.reverse(list);
return String.join(".", list);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Strict parser doesn't add ext properties to task hash

3 participants