Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -149,13 +149,12 @@ public void endVisit(ASTCreatorExpression expr) {
* thus we do not need to modify Type4Ast.
*/
protected SymTypeExpression getCreatorType(ASTCreator creator) {
//todo use TypeDispatcher as soon as it is fixed
SymTypeExpression creatorType;
if (creator instanceof ASTClassCreator) {
creatorType = getClassCreatorType((ASTClassCreator) creator);
if (creator instanceof ASTClassCreator classCreator) {
creatorType = getClassCreatorType(classCreator);
}
else if (creator instanceof ASTArrayCreator) {
creatorType = getArrayCreatorType((ASTArrayCreator) creator);
else if (creator instanceof ASTArrayCreator arrayCreator) {
creatorType = getArrayCreatorType(arrayCreator);
}
else {
// hint: if the other ASTCreators have been added in another class,
Expand Down Expand Up @@ -259,7 +258,6 @@ protected SymTypeExpression getArrayCreatorType(ASTArrayCreator creator) {
protected Optional<Integer> getArrayDimensionSpecifierSize(
ASTArrayDimensionSpecifier dimSpec) {
Optional<Integer> dimensions;
// todo use typedispatcher as soon as it works
if (dimSpec instanceof ASTArrayDimensionByExpression dims) {
List<SymTypeExpression> expressions = dims.getExpressionList().stream()
.map(e -> getType4Ast().getPartialTypeOfExpr(e))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -431,9 +431,8 @@ public static SymTypeOfGenerics createGenerics(String name, IBasicSymbolsScope e
* whenever appropriate
*/
public static SymTypeExpression createFromSymbol(TypeSymbol typeSymbol) {
// TODO: use TypeDispatcher as soon as it is fixed
if(typeSymbol instanceof TypeVarSymbol) {
return createTypeVariable((TypeVarSymbol) typeSymbol);
if(typeSymbol instanceof TypeVarSymbol typeVarSymbol) {
return createTypeVariable(typeVarSymbol);
}
if(typeSymbol.getSpannedScope().getLocalTypeVarSymbols().isEmpty()) {
return createTypeObject(typeSymbol);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,9 @@ public void endVisit(ASTMCBracketType bracketType) {
*/
protected List<ASTMCType> transformUnionTree2List(ASTMCType mcType) {
List<ASTMCType> result = new ArrayList<>();
// todo replace with typedispatcher as soon as the issues are fixed
// https://git.rwth-aachen.de/monticore/monticore/-/issues/3525
if (mcType instanceof ASTMCUnionType) {
result.addAll(transformUnionTree2List(((ASTMCUnionType) mcType).getLeft()));
result.addAll(transformUnionTree2List(((ASTMCUnionType) mcType).getRight()));
if (mcType instanceof ASTMCUnionType unionType) {
result.addAll(transformUnionTree2List(unionType.getLeft()));
result.addAll(transformUnionTree2List(unionType.getRight()));
}
else {
result.add(mcType);
Expand All @@ -126,11 +124,9 @@ protected List<ASTMCType> transformUnionTree2List(ASTMCType mcType) {
*/
protected List<ASTMCType> transformIntersectionTree2List(ASTMCType mcType) {
List<ASTMCType> result = new ArrayList<>();
// todo replace with typedispatcher as soon as the issues are fixed
// https://git.rwth-aachen.de/monticore/monticore/-/issues/3525
if (mcType instanceof ASTMCIntersectionType) {
result.addAll(transformIntersectionTree2List(((ASTMCIntersectionType) mcType).getLeft()));
result.addAll(transformIntersectionTree2List(((ASTMCIntersectionType) mcType).getRight()));
if (mcType instanceof ASTMCIntersectionType intersectionType) {
result.addAll(transformIntersectionTree2List(intersectionType.getLeft()));
result.addAll(transformIntersectionTree2List(intersectionType.getRight()));
}
else {
result.add(mcType);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ protected Optional<TypeSymbol> _getEnclosingType(IScope enclosingScope) {
for (IScope scope = enclosingScope;
scope != null && enclosingType.isEmpty();
scope = scope.getEnclosingScope()) {
//TODO: use TypeDispatcher as soon as it is fixed
if (scope.isPresentSpanningSymbol() && scope.getSpanningSymbol() instanceof TypeSymbol) {
enclosingType = Optional.of((TypeSymbol) scope.getSpanningSymbol());
if (scope.isPresentSpanningSymbol()
&& scope.getSpanningSymbol() instanceof TypeSymbol typeSymbol) {
enclosingType = Optional.of(typeSymbol);
}
}
return enclosingType;
Expand Down
Loading