Commit 55c9f80b authored by Evgeny Kusmenko's avatar Evgeny Kusmenko
Browse files

Merge branch 'PortsWithGenericsFix' into 'master'

Ports with generics fix

See merge request !12
parents b7a88dcb b9eefc89
Pipeline #91615 passed with stage
in 4 minutes and 56 seconds
......@@ -30,7 +30,7 @@
<groupId>de.monticore.lang.monticar</groupId>
<artifactId>embedded-montiarc</artifactId>
<version>0.1.6-SNAPSHOT</version>
<version>0.1.7-SNAPSHOT</version>
<!-- == PROJECT DEPENDENCIES ============================================= -->
......@@ -324,6 +324,7 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<useSystemClassLoader>false</useSystemClassLoader>
</configuration>
</plugin>
<plugin>
......
......@@ -116,7 +116,7 @@ public class EMAComponentSymbolReference extends EMAComponentSymbol implements
for (ResolutionDeclarationSymbol resDeclSym : getResolutionDeclarationSymbols()) {
//Log.debug("" + ((ASTUnitNumberResolution) getResolutionDeclarationSymbols().get(count).getASTResolution()).getNumber().get().intValue(), "resolus:");
String lastNameStart = "";
for (EMAPortSymbol emaPortSymbol : getIncomingPorts()) {
for (EMAPortSymbol emaPortSymbol : getPortsList()) {
Log.debug(emaPortSymbol.getName(), "Found Port:");
if (!emaPortSymbol.getNameWithoutArrayBracketPart().equals(lastNameStart)) {
lastNameStart = emaPortSymbol.getNameWithoutArrayBracketPart();
......
......@@ -868,5 +868,31 @@ public class SymtabTest extends AbstractSymtabTest {
}
@Test
public void testBasicGenericArrayInstance(){
Scope symTab = createSymTab("src/test/resources");
EMAComponentInstanceSymbol componentInstanceSymbol = symTab.<EMAComponentInstanceSymbol>resolve("test.basicGenericArrayInstance", EMAComponentInstanceSymbol.KIND).orElse(null);
assertNotNull(componentInstanceSymbol);
for(int i = 1; i <= 6; i++){
assertTrue(componentInstanceSymbol.getPortInstance("aVal1["+i+"]").isPresent());
assertTrue(componentInstanceSymbol.getPortInstance("aValOut["+i+"]").isPresent());
}
EMAComponentInstanceSymbol subComp1 = componentInstanceSymbol.getSubComponent("basicGenericArraySize1").orElse(null);
EMAComponentInstanceSymbol subComp2 = componentInstanceSymbol.getSubComponent("basicGenericArraySize2").orElse(null);
assertNotNull(subComp1);
assertNotNull(subComp2);
for(int i = 1; i <= 3; i++) {
assertTrue("basicGenericArraySize1.val1["+i+"] not found", subComp1.getPortInstance("val1["+i+"]").isPresent());
assertTrue("basicGenericArraySize2.val1["+i+"] not found", subComp2.getPortInstance("val1["+i+"]").isPresent());
assertTrue("basicGenericArraySize1.valOut["+i+"] not found",subComp1.getPortInstance("valOut["+i+"]").isPresent());
assertTrue("basicGenericArraySize2.valOut["+i+"] not found",subComp2.getPortInstance("valOut["+i+"]").isPresent());
}
}
}
package test;
component BasicGenericArrayInstance{
ports in Q aVal1[6],
out Q aValOut[6];
instance BasicGenericArraySize<3> basicGenericArraySize1;
instance BasicGenericArraySize<3> basicGenericArraySize2;
connect aVal1[1:3] -> basicGenericArraySize1.val1[:];
connect aVal1[4:6] -> basicGenericArraySize2.val1[:];
connect basicGenericArraySize1.valOut[:] -> aValOut[1:3];
connect basicGenericArraySize2.valOut[:] -> aValOut[4:6];
}
\ No newline at end of file
package test;
component BasicGenericArraySize<N1 n=1>{
ports in Q val1[n],
out Q valOut[n];
}
\ No newline at end of file
Supports Markdown
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