diff --git a/monticore-grammar/src/main/java/de/monticore/statements/mccommonstatements/_symboltable/MCCommonStatementsSTCompleteTypes.java b/monticore-grammar/src/main/java/de/monticore/statements/mccommonstatements/_symboltable/MCCommonStatementsSTCompleteTypes.java index 407165d926..53fe20ad0c 100644 --- a/monticore-grammar/src/main/java/de/monticore/statements/mccommonstatements/_symboltable/MCCommonStatementsSTCompleteTypes.java +++ b/monticore-grammar/src/main/java/de/monticore/statements/mccommonstatements/_symboltable/MCCommonStatementsSTCompleteTypes.java @@ -10,6 +10,10 @@ import de.monticore.types.check.TypeCheckResult; import de.monticore.types.mcbasictypes._ast.ASTMCType; +/** + * @deprecated Use {@link MCCommonStatementsSymTabCompletion} instead + */ +@Deprecated public class MCCommonStatementsSTCompleteTypes implements MCCommonStatementsVisitor2 { @Override diff --git a/monticore-grammar/src/main/java/de/monticore/statements/mccommonstatements/_symboltable/MCCommonStatementsSymTabCompletion.java b/monticore-grammar/src/main/java/de/monticore/statements/mccommonstatements/_symboltable/MCCommonStatementsSymTabCompletion.java new file mode 100644 index 0000000000..1cdae7c80a --- /dev/null +++ b/monticore-grammar/src/main/java/de/monticore/statements/mccommonstatements/_symboltable/MCCommonStatementsSymTabCompletion.java @@ -0,0 +1,16 @@ +/*(c) https://github.com/MontiCore/monticore*/ +package de.monticore.statements.mccommonstatements._symboltable; + +import de.monticore.statements.mccommonstatements._ast.ASTFormalParameter; +import de.monticore.statements.mccommonstatements._visitor.MCCommonStatementsVisitor2; +import de.monticore.symbols.oosymbols._symboltable.FieldSymbol; +import de.monticore.types3.TypeCheck3; + +public class MCCommonStatementsSymTabCompletion implements MCCommonStatementsVisitor2 { + + @Override + public void endVisit(ASTFormalParameter ast) { + FieldSymbol symbol = ast.getDeclarator().getSymbol(); + symbol.setType(TypeCheck3.symTypeFromAST(ast.getMCType())); + } +} diff --git a/monticore-grammar/src/main/java/de/monticore/statements/mcvardeclarationstatements/_symboltable/MCVarDeclarationStatementsSTCompleteTypes.java b/monticore-grammar/src/main/java/de/monticore/statements/mcvardeclarationstatements/_symboltable/MCVarDeclarationStatementsSTCompleteTypes.java index 7a9f124daf..882db1fb9d 100644 --- a/monticore-grammar/src/main/java/de/monticore/statements/mcvardeclarationstatements/_symboltable/MCVarDeclarationStatementsSTCompleteTypes.java +++ b/monticore-grammar/src/main/java/de/monticore/statements/mcvardeclarationstatements/_symboltable/MCVarDeclarationStatementsSTCompleteTypes.java @@ -12,6 +12,10 @@ import java.util.List; +/** + * @deprecated Use {@link MCVarDeclarationStatementsSymTabCompletion} instead + */ +@Deprecated public class MCVarDeclarationStatementsSTCompleteTypes implements MCVarDeclarationStatementsVisitor2 { protected ISynthesize typeSynthesizer; diff --git a/monticore-grammar/src/main/java/de/monticore/statements/mcvardeclarationstatements/_symboltable/MCVarDeclarationStatementsSymTabCompletion.java b/monticore-grammar/src/main/java/de/monticore/statements/mcvardeclarationstatements/_symboltable/MCVarDeclarationStatementsSymTabCompletion.java new file mode 100644 index 0000000000..d1595a04f9 --- /dev/null +++ b/monticore-grammar/src/main/java/de/monticore/statements/mcvardeclarationstatements/_symboltable/MCVarDeclarationStatementsSymTabCompletion.java @@ -0,0 +1,18 @@ +/*(c) https://github.com/MontiCore/monticore*/ +package de.monticore.statements.mcvardeclarationstatements._symboltable; + +import de.monticore.statements.mcvardeclarationstatements._ast.ASTLocalVariableDeclaration; +import de.monticore.statements.mcvardeclarationstatements._ast.ASTVariableDeclarator; +import de.monticore.statements.mcvardeclarationstatements._visitor.MCVarDeclarationStatementsVisitor2; +import de.monticore.types3.TypeCheck3; + +public class MCVarDeclarationStatementsSymTabCompletion implements MCVarDeclarationStatementsVisitor2 { + + public MCVarDeclarationStatementsSymTabCompletion() { } + + public void endVisit(ASTLocalVariableDeclaration ast) { + for (ASTVariableDeclarator v : ast.getVariableDeclaratorList()) { + v.getDeclarator().getSymbol().setType(TypeCheck3.symTypeFromAST(ast.getMCType())); + } + } +}