Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEd Willink2020-02-26 12:00:46 +0000
committerEd Willink2020-02-26 13:16:06 +0000
commit36f5669e75b946dad6dc3dce8fc127adafe17bf5 (patch)
treec22b71f8c4e0e52da932b0faa0cf175a640c5435 /plugins
parent8ffa1f157907bf73dd646f4eddb4f1318aba7904 (diff)
downloadorg.eclipse.qvtd-36f5669e75b946dad6dc3dce8fc127adafe17bf5.tar.gz
org.eclipse.qvtd-36f5669e75b946dad6dc3dce8fc127adafe17bf5.tar.xz
org.eclipse.qvtd-36f5669e75b946dad6dc3dce8fc127adafe17bf5.zip
[513375] NewStatementPart assignments do not need notify
Diffstat (limited to 'plugins')
-rw-r--r--plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvti/analysis/QVTiProductionConsumption.java52
1 files changed, 30 insertions, 22 deletions
diff --git a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvti/analysis/QVTiProductionConsumption.java b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvti/analysis/QVTiProductionConsumption.java
index 558dd4a53..15a4a824a 100644
--- a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvti/analysis/QVTiProductionConsumption.java
+++ b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvti/analysis/QVTiProductionConsumption.java
@@ -660,12 +660,12 @@ public class QVTiProductionConsumption extends AbstractExtendingQVTimperativeVis
if (connectionAnalyses != null) { // consumption is optional (may be produced only for output)
PassRange overallProductionPassRange = new PassRange();
PassRange overallConsumptionPassRange = new PassRange();
- boolean needsNotify = false;
+ boolean passRangeNeedsNotify = false;
for (@NonNull ConnectionAnalysis connectionAnalysis : connectionAnalyses) {
PassRange productionPassRange = connectionAnalysis.getProductionPassRange();
PassRange consumptionPassRange = connectionAnalysis.getConsumptionPassRange();
if (!productionPassRange.precedes(consumptionPassRange)) {
- needsNotify = true;
+ passRangeNeedsNotify = true;
}
overallProductionPassRange = overallProductionPassRange.max(productionPassRange);
overallConsumptionPassRange = overallConsumptionPassRange.max(consumptionPassRange);
@@ -675,26 +675,34 @@ public class QVTiProductionConsumption extends AbstractExtendingQVTimperativeVis
//
// boolean needsNotify = !productionPassRange.precedes(consumptionPassRange);
for (@NonNull NamedElement producer : producingAnalysis.producers) {
- if (!(producer instanceof GuardParameter)) { // GuardParameter are implicitly notified; no need to check
- boolean isNotify = isNotify(producer);
- if (isNotify != needsNotify) {
- Property property = producingAnalysis.property;
- StringBuilder sProblem = new StringBuilder();
- sProblem.append("The production of: ");
- sProblem.append(PrettyPrinter.print(property));
- sProblem.append("\n\tat ");
- sProblem.append(overallProductionPassRange);
- sProblem.append(" should");
- if (isNotify) {
- sProblem.append(" not");
- }
- sProblem.append(" be notified for use at ");
- sProblem.append(overallConsumptionPassRange);
- Mapping mapping = QVTimperativeUtil.getContainingMapping(producer);
- compilerStep.addProblem(new MappingProblem(CompilerProblem.Severity.WARNING, mapping, sProblem.toString()));
- if (s != null) {
- s.append("\n BAD " + sProblem);
- }
+ boolean needsNotify;
+ if (producer instanceof GuardParameter) {
+ needsNotify = false; // GuardParameter are implicitly notified; no need to check
+ }
+ else if (producer instanceof NewStatementPart) {
+ needsNotify = false; // NewStatementPart are assigned on construction no need to check
+ }
+ else {
+ needsNotify = passRangeNeedsNotify;
+ }
+ boolean isNotify = isNotify(producer);
+ if (isNotify != needsNotify) {
+ Property property = producingAnalysis.property;
+ StringBuilder sProblem = new StringBuilder();
+ sProblem.append("The production of: ");
+ sProblem.append(PrettyPrinter.print(property));
+ sProblem.append("\n\tat ");
+ sProblem.append(overallProductionPassRange);
+ sProblem.append(" should");
+ if (isNotify) {
+ sProblem.append(" not");
+ }
+ sProblem.append(" be notified for use at ");
+ sProblem.append(overallConsumptionPassRange);
+ Mapping mapping = QVTimperativeUtil.getContainingMapping(producer);
+ compilerStep.addProblem(new MappingProblem(CompilerProblem.Severity.WARNING, mapping, sProblem.toString()));
+ if (s != null) {
+ s.append("\n BAD " + sProblem);
}
}
}

Back to the top