diff options
author | Henrik Rentz-Reichert | 2012-11-12 15:36:18 +0000 |
---|---|---|
committer | Henrik Rentz-Reichert | 2012-11-12 15:36:18 +0000 |
commit | 824f3731d4f02ce14dcd0b969329354662890134 (patch) | |
tree | f2760d743f13aa439e8dcdd720df2e5bd2ae685a /plugins/org.eclipse.etrice.generator.java | |
parent | b6333b6fd46f7886ca8639079945a1784120ebb4 (diff) | |
download | org.eclipse.etrice-824f3731d4f02ce14dcd0b969329354662890134.tar.gz org.eclipse.etrice-824f3731d4f02ce14dcd0b969329354662890134.tar.xz org.eclipse.etrice-824f3731d4f02ce14dcd0b969329354662890134.zip |
[generator.java] minor improvement to avoid unused variables
Diffstat (limited to 'plugins/org.eclipse.etrice.generator.java')
2 files changed, 39 insertions, 28 deletions
diff --git a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/SubSystemClassGen.xtend b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/SubSystemClassGen.xtend index a6ea5f409..17ae171b0 100644 --- a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/SubSystemClassGen.xtend +++ b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/SubSystemClassGen.xtend @@ -175,10 +175,13 @@ class SubSystemClassGen { // apply instance attribute configurations
«FOR ai: comp.allContainedInstances»
- {
- «ai.actorClass.name» inst = («ai.actorClass.name») instances[«comp.allContainedInstances.indexOf(ai)»];
- «configGenAddon.genActorInstanceConfig(ai, "inst")»
- }
+ «val cfg = configGenAddon.genActorInstanceConfig(ai, "inst")»
+ «IF cfg.length>0»
+ {
+ «ai.actorClass.name» inst = («ai.actorClass.name») instances[«comp.allContainedInstances.indexOf(ai)»];
+ «cfg»
+ }
+ «ENDIF»
«ENDFOR»
// create the subsystem system port
diff --git a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/SubSystemClassGen.java b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/SubSystemClassGen.java index e78955b91..cd2942b58 100644 --- a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/SubSystemClassGen.java +++ b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/SubSystemClassGen.java @@ -597,31 +597,39 @@ public class SubSystemClassGen { EList<ActorInstance> _allContainedInstances_8 = comp.getAllContainedInstances();
for(final ActorInstance ai_3 : _allContainedInstances_8) {
_builder.append("\t\t");
- _builder.append("{");
- _builder.newLine();
- _builder.append("\t\t");
- _builder.append("\t");
- ActorClass _actorClass_1 = ai_3.getActorClass();
- String _name_6 = _actorClass_1.getName();
- _builder.append(_name_6, " ");
- _builder.append(" inst = (");
- ActorClass _actorClass_2 = ai_3.getActorClass();
- String _name_7 = _actorClass_2.getName();
- _builder.append(_name_7, " ");
- _builder.append(") instances[");
- EList<ActorInstance> _allContainedInstances_9 = comp.getAllContainedInstances();
- int _indexOf_7 = _allContainedInstances_9.indexOf(ai_3);
- _builder.append(_indexOf_7, " ");
- _builder.append("];");
- _builder.newLineIfNotEmpty();
- _builder.append("\t\t");
- _builder.append("\t");
- CharSequence _genActorInstanceConfig = this.configGenAddon.genActorInstanceConfig(ai_3, "inst");
- _builder.append(_genActorInstanceConfig, " ");
+ final CharSequence cfg = this.configGenAddon.genActorInstanceConfig(ai_3, "inst");
_builder.newLineIfNotEmpty();
- _builder.append("\t\t");
- _builder.append("}");
- _builder.newLine();
+ {
+ int _length = cfg.length();
+ boolean _greaterThan = (_length > 0);
+ if (_greaterThan) {
+ _builder.append("\t\t");
+ _builder.append("{");
+ _builder.newLine();
+ _builder.append("\t\t");
+ _builder.append("\t");
+ ActorClass _actorClass_1 = ai_3.getActorClass();
+ String _name_6 = _actorClass_1.getName();
+ _builder.append(_name_6, " ");
+ _builder.append(" inst = (");
+ ActorClass _actorClass_2 = ai_3.getActorClass();
+ String _name_7 = _actorClass_2.getName();
+ _builder.append(_name_7, " ");
+ _builder.append(") instances[");
+ EList<ActorInstance> _allContainedInstances_9 = comp.getAllContainedInstances();
+ int _indexOf_7 = _allContainedInstances_9.indexOf(ai_3);
+ _builder.append(_indexOf_7, " ");
+ _builder.append("];");
+ _builder.newLineIfNotEmpty();
+ _builder.append("\t\t");
+ _builder.append("\t");
+ _builder.append(cfg, " ");
+ _builder.newLineIfNotEmpty();
+ _builder.append("\t\t");
+ _builder.append("}");
+ _builder.newLine();
+ }
+ }
}
}
_builder.newLine();
|