Commit 9f05b087 authored by Sascha Niklas Schneiders's avatar Sascha Niklas Schneiders
Browse files

Revert "issue #2 add code to make EMA2Kotlin work"

This reverts commit bb243c36.
parent 65e65cc1
......@@ -35,7 +35,6 @@
<!-- == PROJECT DEPENDENCIES ============================================= -->
<properties>
<kotlin.version>1.1.51</kotlin.version>
<wagon.provider.version>2.6</wagon.provider.version>
<!-- DSLs -->
<javadsl.version>4.3.9</javadsl.version>
......@@ -48,7 +47,6 @@
<mc.grammars.assembly.version>0.0.6-SNAPSHOT</mc.grammars.assembly.version>
<languages.version>4.0.1-SNAPSHOT</languages.version>
<SIUnit.version>0.0.6-SNAPSHOT</SIUnit.version>
<struct.version>0.0.3-SNAPSHOT</struct.version>
<Common-MontiCar.version>0.0.3-SNAPSHOT</Common-MontiCar.version>
......@@ -79,20 +77,6 @@
</properties>
<dependencies>
<dependency>
<groupId>de.monticore.lang.monticar</groupId>
<artifactId>struct</artifactId>
<version>${struct.version}</version>
</dependency>
<dependency>
<groupId>de.monticore.lang.monticar</groupId>
<artifactId>struct</artifactId>
<version>${struct.version}</version>
<classifier>${grammars.classifier}</classifier>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>de.se_rwth.commons</groupId>
<artifactId>se-commons-logging</artifactId>
......@@ -234,19 +218,7 @@
<artifactId>jscience</artifactId>
<version>${jscience.version}</version>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-jre8</artifactId>
<version>${kotlin.version}</version>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-test-junit</artifactId>
<version>${kotlin.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
......@@ -315,38 +287,6 @@
</plugin>
<!-- Other Configuration -->
<plugin>
<artifactId>kotlin-maven-plugin</artifactId>
<configuration>
<jvmTarget>1.8</jvmTarget>
</configuration>
<groupId>org.jetbrains.kotlin</groupId>
<version>${kotlin.version}</version>
<executions>
<execution>
<id>compile</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<sourceDirs>
<source>src/main/java</source>
<source>target/generated-sources/monticore/sourcecode</source>
<source>src/main/kotlin</source>
</sourceDirs>
</configuration>
</execution>
<execution>
<id>test-compile</id>
<phase>test-compile</phase>
<goals>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>${compiler.plugin}</version>
......@@ -468,8 +408,12 @@
</instrumentation>
</configuration>
</plugin>
<<<<<<< HEAD
</plugins>
</pluginManagement>
=======
</plugins>
>>>>>>> parent of bb243c3... issue #2 add code to make EMA2Kotlin work
</build>
<distributionManagement>
......
/**
*
* ******************************************************************************
* MontiCAR Modeling Family, www.se-rwth.de
* Copyright (c) 2017, Software Engineering Group at RWTH Aachen,
* All rights reserved.
*
* This project is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this project. If not, see <http://www.gnu.org/licenses/>.
* *******************************************************************************
*/
package de.monticore.lang.embeddedmontiarc;
import de.monticore.lang.monticar.struct.model.type.StructFieldTypeInfo;
import javax.annotation.Nonnull;
public class FormalTypeParameterFieldType implements StructFieldTypeInfo {
@Nonnull
private final String formalTypeParameterName;
public FormalTypeParameterFieldType(@Nonnull String formalTypeParameterName) {
this.formalTypeParameterName = formalTypeParameterName;
}
@Nonnull
public String getFormalTypeParameterName() {
return formalTypeParameterName;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
FormalTypeParameterFieldType that = (FormalTypeParameterFieldType) o;
return getFormalTypeParameterName().equals(that.getFormalTypeParameterName());
}
@Override
public int hashCode() {
return getFormalTypeParameterName().hashCode();
}
}
......@@ -24,7 +24,6 @@ import de.monticore.ast.ASTNode;
//import de.monticore.common.common._ast.ASTStereoValue;
import de.monticore.java.symboltable.JavaSymbolFactory;
import de.monticore.java.symboltable.JavaTypeSymbolReference;
import de.monticore.lang.embeddedmontiarc.FormalTypeParameterFieldType;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._ast.*;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc.types.TypesPrinter;
import de.monticore.lang.embeddedmontiarc.helper.ArcTypePrinter;
......@@ -44,7 +43,6 @@ import de.monticore.lang.monticar.resolution._ast.ASTTypeArgument;
import de.monticore.lang.monticar.si._symboltable.ResolutionDeclarationSymbol;
import de.monticore.lang.monticar.si._symboltable.ResolutionDeclarationSymbolReference;
import de.monticore.lang.monticar.si._symboltable.SIUnitRangesSymbolReference;
import de.monticore.lang.monticar.struct.model.type.StructFieldTypeInfo;
import de.monticore.symboltable.*;
import de.monticore.symboltable.modifiers.BasicAccessModifier;
import de.monticore.symboltable.types.JFieldSymbol;
......@@ -175,9 +173,6 @@ public class EmbeddedMontiArcSymbolTableCreator extends EmbeddedMontiArcSymbolTa
typeName.append(ArcTypePrinter.printTypeWithoutTypeArgumentsAndDimension(astType));
//Log.debug(astType.toString(),"TYPE:");
//Log.debug(typeName,"TYPEName:");
if ("".equals(typeName.toString())) {
typeName.append("java.lang.Object");
}
typeRef = new CommonJTypeReference<JTypeSymbol>(typeName.toString(), JTypeSymbol.KIND, currentScope().get());
typeRef.setDimension(TypesHelper.getArrayDimensionIfArrayOrZero(astType));
addTypeArgumentsToTypeSymbol(typeRef, astType);
......@@ -250,7 +245,6 @@ public class EmbeddedMontiArcSymbolTableCreator extends EmbeddedMontiArcSymbolTa
} else {
// create PortSymbol with same content as PortArraySymbol
createPort(node, name, node.isIncoming(), pas.getStereotype(), typeRef, pas);
((PortSymbol)node.getSymbol().get()).setTypeInfo(pas.getTypeInfo());
}
}
......@@ -313,25 +307,6 @@ public class EmbeddedMontiArcSymbolTableCreator extends EmbeddedMontiArcSymbolTa
PortArraySymbol pas = new PortArraySymbol(name, nameTO);
pas.setTypeReference(typeRef);
StructFieldTypeInfo typeInfo = null;
if (astType instanceof ASTSimpleReferenceType && componentStack.peek().hasFormalTypeParameters()) {
List<String> names = ((ASTSimpleReferenceType) astType).getNames();
if (names != null && names.size() == 1) {
String possibleFormalTypeParamName = names.get(0);
boolean isFormalTypeParameterOfParent = componentStack
.peek()
.getFormalTypeParameters()
.stream()
.anyMatch(p -> p.isFormalTypeParameter() && p.getName().equals(possibleFormalTypeParamName));
if (isFormalTypeParameterOfParent) {
typeInfo = new FormalTypeParameterFieldType(possibleFormalTypeParamName);
}
}
}
if (typeInfo == null) {
typeInfo = StructFieldTypeInfo.tryRepresentASTType(astType, currentScope().orElse(null));
}
pas.setTypeInfo(typeInfo);
pas.setDirection(node.isIncoming());
// stereotype
......
......@@ -23,7 +23,6 @@ package de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable;
import de.monticore.lang.embeddedmontiarc.helper.SymbolPrinter;
import de.monticore.lang.monticar.stream._symboltable.NamedStreamSymbol;
import de.monticore.lang.montiarc.tagging._symboltable.TaggingSymbol;
import de.monticore.lang.monticar.struct.model.type.StructFieldTypeInfo;
import de.monticore.symboltable.CommonScope;
import de.monticore.symboltable.MutableScope;
import de.monticore.symboltable.SymbolKind;
......@@ -55,11 +54,6 @@ public class PortSymbol extends TaggingSymbol implements ElementInstance {
private JTypeReference<? extends JTypeSymbol> typeReference;
/**
* Structs do not use JTypeReference but StructFieldTypeInfo.
*/
private StructFieldTypeInfo typeInfo;
private MutableScope locallyDefinedStreams = new CommonScope();
protected Optional<String> nameDependsOn = Optional.empty();
......@@ -114,14 +108,6 @@ public class PortSymbol extends TaggingSymbol implements ElementInstance {
this.typeReference = typeReference;
}
public StructFieldTypeInfo getTypeInfo() {
return typeInfo;
}
public void setTypeInfo(StructFieldTypeInfo typeInfo) {
this.typeInfo = typeInfo;
}
/**
* returns the component which defines the connector
* this is independent from the component to which the source and target ports
......
......@@ -97,25 +97,12 @@ public class TypesPrinter {
if (type instanceof ASTPrintType) {
return ((ASTPrintType) type).printType();
}else if(type instanceof ASTElementType){
ASTElementType elementType = (ASTElementType) type;
if (elementType.isIsBoolean()) {
return "scalar.B";
}
if (elementType.isIsComplex()) {
return "scalar.C";
}
if (elementType.isIsRational()) {
return "scalar.Q";
}
if (elementType.isIsWholeNumberNumber()) {
return "scalar.Z";
}
return "ElementType";
}
Log.info(type.toString(),"Type:");
Log.warn("Type can not be handled!");
return "java.lang.Object";
Log.error("Type can not be handled!");
return "";
}
public static String printTypeParameters(ASTTypeParameters params) {
......
package scalar;
public class B extends java.lang.ElementType {
}
package scalar;
public class C extends java.lang.ElementType {
}
package scalar;
public class Q extends java.lang.ElementType {
}
package scalar;
public class Z extends java.lang.ElementType {
}
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