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