-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'tc3-symtab' into 'dev'
Add symtab-completion for typecheck 3 See merge request monticore/monticore!1055
- Loading branch information
Showing
4 changed files
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
...ticore/statements/mccommonstatements/_symboltable/MCCommonStatementsSymTabCompletion.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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())); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
...s/mcvardeclarationstatements/_symboltable/MCVarDeclarationStatementsSymTabCompletion.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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())); | ||
} | ||
} | ||
} |