Commit bdb93582 authored by Evgeny Kusmenko's avatar Evgeny Kusmenko
Browse files

Merge branch 'develop' into 'master'

Renamed VariableSymbol to ParameterSymbol

See merge request !16
parents 7ca84024 4871e7a1
Pipeline #171087 passed with stages
in 5 minutes and 34 seconds
......@@ -44,7 +44,7 @@
<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.1-SNAPSHOT</CNNArch.version>
<CNNArch.version>0.3.2-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>
......
......@@ -58,7 +58,7 @@ public class EMADLLanguage extends EmbeddingModelingLanguage {
List<ResolvingFilter<? extends Symbol>> ret =
new ArrayList<>(super.getResolvingFilters());
ret.add(new PortArraySymbol2IODeclarationSymbolTypeFilter());
//ret.add(new ResolutionDeclarationSymbol2VariableSymbolTypeFilter());
//ret.add(new ResolutionDeclarationSymbol2ParameterSymbolTypeFilter());
ret.add(new PortArraySymbol2MathVariableDeclarationSymbolTypeFilter());
ret.add(new ResolutionDeclarationSymbol2MathVariableDeclarationTypeFilter());
......
......@@ -28,8 +28,8 @@ import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.instance
import de.monticore.lang.math._ast.ASTNumberExpression;
import de.monticore.lang.monticar.cnnarch._symboltable.ArchSimpleExpressionSymbol;
import de.monticore.lang.monticar.cnnarch._symboltable.ArchitectureSymbol;
import de.monticore.lang.monticar.cnnarch._symboltable.VariableSymbol;
import de.monticore.lang.monticar.cnnarch._symboltable.VariableType;
import de.monticore.lang.monticar.cnnarch._symboltable.ParameterSymbol;
import de.monticore.lang.monticar.cnnarch._symboltable.ParameterType;
import de.monticore.lang.monticar.si._symboltable.ResolutionDeclarationSymbol;
import de.monticore.lang.monticar.ts.MCFieldSymbol;
import de.monticore.lang.monticar.resolution._ast.ASTUnitNumberResolution;
......@@ -49,7 +49,7 @@ public class ModifiedExpandedComponentInstanceBuilder extends EMAComponentInstan
if (architecture.isPresent()){
addPortArraySymbolsToInstance(instance);
addVariableSymbolsToInstance(instance);
addParameterSymbolsToInstance(instance);
ArchitectureSymbol architectureInstance = architecture.get()
.preResolveDeepCopy(instance.getSpannedScope());
......@@ -58,14 +58,14 @@ public class ModifiedExpandedComponentInstanceBuilder extends EMAComponentInstan
return instance;
}
public void addVariableSymbolsToInstance(EMAComponentInstanceSymbol instance){
public void addParameterSymbolsToInstance(EMAComponentInstanceSymbol instance){
//add generics
for (ResolutionDeclarationSymbol sym : instance.getResolutionDeclarationSymbols()){
if (sym.getASTResolution() instanceof ASTUnitNumberResolution){
ASTUnitNumberResolution numberResolution = (ASTUnitNumberResolution) sym.getASTResolution();
VariableSymbol genericsParam = new VariableSymbol.Builder()
ParameterSymbol genericsParam = new ParameterSymbol.Builder()
.name(sym.getNameToResolve())
.type(VariableType.ARCHITECTURE_PARAMETER)
.type(ParameterType.ARCHITECTURE_PARAMETER)
.build();
genericsParam.setExpression(ArchSimpleExpressionSymbol.of(numberResolution.getNumber().get()));
instance.getSpannedScope().getAsMutableScope().add(genericsParam);
......@@ -83,9 +83,9 @@ public class ModifiedExpandedComponentInstanceBuilder extends EMAComponentInstan
ASTNumberExpression exp = (ASTNumberExpression) instance.getArguments().get(i);
MCFieldSymbol emaParam = instance.getComponentType().getConfigParameters().get(i);
VariableSymbol archParam = new VariableSymbol.Builder()
ParameterSymbol archParam = new ParameterSymbol.Builder()
.name(emaParam.getName())
.type(VariableType.ARCHITECTURE_PARAMETER)
.type(ParameterType.ARCHITECTURE_PARAMETER)
.build();
archParam.setExpression(ArchSimpleExpressionSymbol.of(
exp.getNumberWithUnit().getNumber().get()));
......
......@@ -28,7 +28,7 @@ import de.monticore.lang.math._ast.ASTNumberExpression;
import de.monticore.lang.monticar.cnnarch._symboltable.ArchSimpleExpressionSymbol;
import de.monticore.lang.monticar.cnnarch._symboltable.ArchTypeSymbol;
import de.monticore.lang.monticar.cnnarch._symboltable.IODeclarationSymbol;
import de.monticore.lang.monticar.cnnarch._symboltable.VariableSymbol;
import de.monticore.lang.monticar.cnnarch._symboltable.ParameterSymbol;
import de.monticore.lang.monticar.common2._ast.ASTCommonMatrixType;
import de.monticore.lang.monticar.ts.MCASTTypeSymbol;
import de.monticore.lang.monticar.ts.MCTypeSymbol;
......@@ -99,8 +99,8 @@ public class PortArraySymbol2IODeclarationSymbol extends IODeclarationSymbol
}
else {
String instName = element instanceof ASTNameExpression ? ((ASTNameExpression) element).getName() : element.getSymbolOpt().get().getName();
VariableSymbol variable= port.getEnclosingScope()
.<VariableSymbol>resolve(instName, VariableSymbol.KIND).get();
ParameterSymbol variable= port.getEnclosingScope()
.<ParameterSymbol>resolve(instName, ParameterSymbol.KIND).get();
dimensionList.add(variable.getExpression());
}
}
......
......@@ -22,8 +22,8 @@ package de.monticore.lang.monticar.emadl.adapter;
import de.monticore.ast.ASTNode;
import de.monticore.lang.monticar.cnnarch._symboltable.ArchSimpleExpressionSymbol;
import de.monticore.lang.monticar.cnnarch._symboltable.VariableSymbol;
import de.monticore.lang.monticar.cnnarch._symboltable.VariableType;
import de.monticore.lang.monticar.cnnarch._symboltable.ParameterSymbol;
import de.monticore.lang.monticar.cnnarch._symboltable.ParameterType;
import de.monticore.lang.monticar.si._symboltable.ResolutionDeclarationSymbol;
import de.monticore.lang.monticar.resolution._ast.ASTUnitNumberResolution;
import de.monticore.symboltable.resolving.SymbolAdapter;
......@@ -32,14 +32,14 @@ import org.jscience.mathematics.number.Rational;
import java.util.Optional;
public class ResolutionDeclarationSymbol2VariableSymbol extends VariableSymbol
public class ResolutionDeclarationSymbol2ParameterSymbol extends ParameterSymbol
implements SymbolAdapter<ResolutionDeclarationSymbol> {
private final ResolutionDeclarationSymbol adaptee;
public ResolutionDeclarationSymbol2VariableSymbol(ResolutionDeclarationSymbol ps, ASTUnitNumberResolution unitNumberResolution) {
public ResolutionDeclarationSymbol2ParameterSymbol(ResolutionDeclarationSymbol ps, ASTUnitNumberResolution unitNumberResolution) {
super(ps.getName());
setType(VariableType.ARCHITECTURE_PARAMETER);
setType(ParameterType.ARCHITECTURE_PARAMETER);
Double doubleValue = unitNumberResolution.getNumberWithUnit().getNumber().get();
setExpression(ArchSimpleExpressionSymbol.of((doubleValue % 1)!= 0
? doubleValue.intValue()
......
......@@ -20,25 +20,25 @@
*/
package de.monticore.lang.monticar.emadl.adapter;
import de.monticore.lang.monticar.cnnarch._symboltable.VariableSymbol;
import de.monticore.lang.monticar.cnnarch._symboltable.ParameterSymbol;
import de.monticore.lang.monticar.si._symboltable.ResolutionDeclarationSymbol;
import de.monticore.lang.monticar.resolution._ast.ASTUnitNumberResolution;
import de.monticore.symboltable.Symbol;
import de.monticore.symboltable.resolving.TransitiveAdaptedResolvingFilter;
public class ResolutionDeclarationSymbol2VariableSymbolTypeFilter extends TransitiveAdaptedResolvingFilter<VariableSymbol> {
public class ResolutionDeclarationSymbol2ParameterSymbolTypeFilter extends TransitiveAdaptedResolvingFilter<ParameterSymbol> {
public ResolutionDeclarationSymbol2VariableSymbolTypeFilter() {
public ResolutionDeclarationSymbol2ParameterSymbolTypeFilter() {
super(ResolutionDeclarationSymbol.KIND,
VariableSymbol.class,
VariableSymbol.KIND);
ParameterSymbol.class,
ParameterSymbol.KIND);
}
@Override
public Symbol translate(Symbol adaptee) {
assert adaptee instanceof ResolutionDeclarationSymbol;
if (((ResolutionDeclarationSymbol) adaptee).getASTResolution() instanceof ASTUnitNumberResolution){
return new ResolutionDeclarationSymbol2VariableSymbol((ResolutionDeclarationSymbol) adaptee, ((ASTUnitNumberResolution) ((ResolutionDeclarationSymbol) adaptee).getASTResolution()));
return new ResolutionDeclarationSymbol2ParameterSymbol((ResolutionDeclarationSymbol) adaptee, ((ASTUnitNumberResolution) ((ResolutionDeclarationSymbol) adaptee).getASTResolution()));
}
return null;
}
......
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