Commit 1b16b430 authored by Malte Heithoff's avatar Malte Heithoff
Browse files

Update versions + instance structure building

parent a3438ace
Pipeline #325161 failed with stage
in 19 seconds
<!--
(c) https://github.com/MontiCore/monticore
The license generally applicable for this project
can be found under https://github.com/MontiCore/monticore.
-->
<!-- (c) https://github.com/MontiCore/monticore -->
<project xmlns="http://maven.apache.org/POM/4.0.0"
......@@ -18,24 +10,26 @@
<groupId>de.monticore.lang.monticar</groupId>
<artifactId>embedded-montiarc-deeplearning</artifactId>
<version>0.2.11-SNAPSHOT</version>
<version>0.2.12-SNAPSHOT</version>
<!-- == PROJECT DEPENDENCIES ============================================= -->
<properties>
<!-- .. EMA-Libraries ................................................. -->
<Common-MontiCar.version>0.2.12-SNAPSHOT</Common-MontiCar.version>
<Embedded-MontiArc.version>0.2.12-SNAPSHOT</Embedded-MontiArc.version>
<Embedded-MontiArc-Math.version>0.2.12-SNAPSHOT</Embedded-MontiArc-Math.version>
<Embedded-MontiArc-Dynamics.version>0.2.12-SNAPSHOT</Embedded-MontiArc-Dynamics.version>
<Embedded-MontiArc-Behaviour.version>0.2.12-SNAPSHOT</Embedded-MontiArc-Behaviour.version>
<Math.version>0.2.12-SNAPSHOT</Math.version>
<MathOpt.version>0.2.12-SNAPSHOT</MathOpt.version>
<!-- .. SE-Libraries .................................................. -->
<monticore.version>5.0.1</monticore.version>
<se-commons.version>1.7.8</se-commons.version>
<mc.grammars.assembly.version>0.0.6</mc.grammars.assembly.version>
<Common-MontiCar.version>0.0.19-SNAPSHOT</Common-MontiCar.version>
<Embedded-MontiArc.version>0.1.9-SNAPSHOT</Embedded-MontiArc.version>
<Embedded-MontiArc-Math.version>0.1.9-SNAPSHOT</Embedded-MontiArc-Math.version>
<Embedded-MontiArc-Behaviour.version>0.0.16-SNAPSHOT</Embedded-MontiArc-Behaviour.version>
<CNNArch.version>0.3.4-SNAPSHOT</CNNArch.version>
<Math.version>0.0.19-SNAPSHOT</Math.version>
<MathOpt.version>0.1.1-SNAPSHOT</MathOpt.version>
<embedded-montiarc-dynamics.version>0.0.4-SNAPSHOT</embedded-montiarc-dynamics.version>
<!-- .. Libraries .................................................. -->
<guava.version>18.0</guava.version>
......@@ -225,13 +219,13 @@
<dependency>
<groupId>de.monticore.lang.monticar</groupId>
<artifactId>embedded-montiarc-dynamics</artifactId>
<version>${embedded-montiarc-dynamics.version}</version>
<version>${Embedded-MontiArc-Dynamics.version}</version>
</dependency>
<dependency>
<groupId>de.monticore.lang.monticar</groupId>
<artifactId>embedded-montiarc-dynamics</artifactId>
<version>${embedded-montiarc-dynamics.version}</version>
<version>${Embedded-MontiArc-Dynamics.version}</version>
<classifier>${grammars.classifier}</classifier>
<scope>provided</scope>
</dependency>
......
/**
* (c) https://github.com/MontiCore/monticore
*
* The license generally applicable for this project
* can be found under https://github.com/MontiCore/monticore.
*/
/* (c) https://github.com/MontiCore/monticore */
package de.monticore.lang.monticar.emadl._symboltable;
......@@ -29,23 +23,30 @@ public class ModifiedExpandedComponentInstanceBuilder extends EMAComponentInstan
@Override
public EMAComponentInstanceSymbol build() {
EMAComponentInstanceSymbol instance = super.build();
EMAComponentSymbol component = instance.getComponentType().getReferencedSymbol();
Optional<ArchitectureSymbol> architecture = component.getSpannedScope()
Optional<ArchitectureSymbol> architecture = instance.getSpannedScope()
.resolve("", ArchitectureSymbol.KIND);
if (architecture.isPresent()){
// Need to be done after parameter exchange, so after build
if (architecture.isPresent())
addArchitectureParameterSymbolsToInstance(instance);
return instance;
}
addPortArraySymbolsToInstance(instance);
addParameterSymbolsToInstance(instance);
@Override protected void addOtherToComponentInstance(EMAComponentInstanceSymbol sym) {
EMAComponentSymbol component = sym.getComponentType().getReferencedSymbol();
Optional<ArchitectureSymbol> architecture = component.getSpannedScope()
.resolve("", ArchitectureSymbol.KIND);
if (architecture.isPresent()){
ArchitectureSymbol architectureInstance = architecture.get()
.preResolveDeepCopy(instance.getSpannedScope());
instance.getSpannedScope().getAsMutableScope().add(architectureInstance);
.preResolveDeepCopy(sym.getSpannedScope());
sym.getSpannedScope().getAsMutableScope().add(architectureInstance);
}
return instance;
}
public void addParameterSymbolsToInstance(EMAComponentInstanceSymbol instance){
public void addArchitectureParameterSymbolsToInstance(EMAComponentInstanceSymbol instance){
//add generics
for (ResolutionDeclarationSymbol sym : instance.getResolutionDeclarationSymbols()){
if (sym.getASTResolution() instanceof ASTUnitNumberResolution){
......@@ -87,24 +88,4 @@ public class ModifiedExpandedComponentInstanceBuilder extends EMAComponentInstan
}
}
public void addPortArraySymbolsToInstance(EMAComponentInstanceSymbol instance){
Map<String, List<EMAPortInstanceSymbol>> nameToPortList = new HashMap<>();
for (EMAPortInstanceSymbol port : instance.getPortInstanceList()){
List<EMAPortInstanceSymbol> list = nameToPortList
.computeIfAbsent(port.getNameWithoutArrayBracketPart(), k -> new ArrayList<>());
list.add(port);
}
for (String name : nameToPortList.keySet()){
if (!instance.getSpannedScope().resolveLocally(name, EMAPortArraySymbol.KIND).isPresent()) {
List<EMAPortInstanceSymbol> ports = nameToPortList.get(name);
EMAPortArraySymbol portArray = new EMAPortArraySymbol(name, null);
portArray.setDimension(ports.size());
portArray.setDirection(ports.get(0).isIncoming());
portArray.setTypeReference(ports.get(0).getTypeReference());
instance.getSpannedScope().getAsMutableScope().add(portArray);
}
}
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment