Skip to content

Commit

Permalink
Merge pull request #316 from nipunayf/worker-model
Browse files Browse the repository at this point in the history
Sync worker model changes
  • Loading branch information
keizer619 authored Jan 5, 2024
2 parents 9d9f006 + a00ccd2 commit b5e3fe9
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 14 deletions.
16 changes: 8 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -141,14 +141,6 @@ task copyArtifactZip {
from targetGraphqlModelGeneratorLSExt
into file("$artifactGraphqlLibParent/ls-libs")
}
copy {
from targetWorkerModelGeneratorCore
into file("$artifactWorkerLibParent/libs")
}
copy {
from targetWorkerModelGeneratorLSExt
into file("$artifactWorkerLibParent/ls-libs")
}
copy {
from targetSequenceDiagramGeneratorCore
into file("$artifactSequenceLibParent/libs")
Expand All @@ -157,6 +149,14 @@ task copyArtifactZip {
from targetSequenceDiagramGeneratorLSExt
into file("$artifactSequenceLibParent/ls-libs")
}
copy {
from targetWorkerModelGeneratorCore
into file("$artifactWorkerLibParent/libs")
}
copy {
from targetWorkerModelGeneratorLSExt
into file("$artifactWorkerLibParent/ls-libs")
}
}
outputs.dir artifactLibParent
doNotTrackState("build needs to run every time")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public class Analyzer extends NodeVisitor {
private final NodeBuilder nodeBuilder;
private final Set<String> moduleTypeSymbols;
protected String toWorker;
protected List<String> fromWorker;
protected List<String> fromWorkers;
private String name;
protected int portId;
protected boolean capturedFromWorker;
Expand All @@ -83,6 +83,7 @@ protected Analyzer(NodeBuilder nodeBuilder, SemanticModel semanticModel, ModuleP
.collect(Collectors.toSet());
this.modulePartNode = modulePartNode;
this.endpointMap = endpointMap;
this.fromWorkers = new ArrayList<>();
this.portId = 0;
}

Expand Down Expand Up @@ -168,7 +169,7 @@ public void visit(VariableDeclarationNode variableDeclarationNode) {
String type = (symbol.isPresent() && symbol.get() instanceof TypeSymbol typeSymbol) ? getTypeName(typeSymbol) :
TypeDescKind.NONE.getName();

for (String worker : this.fromWorker) {
for (String worker : this.fromWorkers) {
this.portId++;
this.nodeBuilder.addInputPort(getPortId(), type, this.name, worker);
}
Expand All @@ -177,12 +178,13 @@ public void visit(VariableDeclarationNode variableDeclarationNode) {

@Override
public void visit(ReceiveActionNode receiveActionNode) {
this.fromWorker = new ArrayList<>();
this.fromWorkers = new ArrayList<>();
Node receiverWorker = receiveActionNode.receiveWorkers();
switch (receiverWorker.kind()) {
case SIMPLE_NAME_REFERENCE -> this.fromWorker.add(((SimpleNameReferenceNode) receiverWorker).name().text());
case SIMPLE_NAME_REFERENCE ->
this.fromWorkers.add(((SimpleNameReferenceNode) receiverWorker).name().text());
case ALTERNATE_RECEIVE_WORKER -> ((AlternateReceiveWorkerNode) receiverWorker).workers()
.forEach(worker -> this.fromWorker.add(worker.name().text()));
.forEach(worker -> this.fromWorkers.add(worker.name().text()));
// TODO: Handle invalid worker receive actions
default -> {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public void visit(FunctionCallExpressionNode functionCallExpressionNode) {
}
//TODO: Handle the case when the parent is null

LineRange lineRange = parent.lineRange();
LineRange lineRange = Objects.requireNonNull(parent).lineRange();
CodeLocation parentLocation = new CodeLocation(lineRange.startLine(), lineRange.endLine());
this.balExpression = new BalExpression(parent.toSourceCode(), parentLocation);
}
Expand Down

0 comments on commit b5e3fe9

Please sign in to comment.