use of nl.ramsolutions.sw.magik.analysis.typing.types.AliasType in project magik-tools by StevenLooman.
the class JsonTypeKeeperReader method handleGlobal.
private void handleGlobal(final JSONObject instruction) {
final String name = instruction.getString("name");
final GlobalReference globalRef = GlobalReference.of(name);
final String typeName = instruction.getString("type_name");
final ExpressionResult parsedResult = this.typeParser.parseExpressionResultString(typeName, SW_PAKKAGE);
final AbstractType type = parsedResult.get(0, UndefinedType.INSTANCE);
final AliasType global = new AliasType(globalRef, type);
this.typeKeeper.addType(global);
}
use of nl.ramsolutions.sw.magik.analysis.typing.types.AliasType in project magik-tools by StevenLooman.
the class MagikIndexer method handleDefinition.
@SuppressWarnings("java:S1172")
private void handleDefinition(final MagikFile magikFile, final GlobalDefinition globalDefinition) {
final String pakkage = globalDefinition.getPackage();
final String identifier = globalDefinition.getName();
final GlobalReference globalRef = typeParser.getGlobalRefeference(identifier, pakkage);
if (this.typeKeeper.getType(globalRef) != null) {
// Don't overwrite any existing types with a AliasType.
return;
}
final String typeAnnotation = TypeAnnotationHandler.typeAnnotationForExpression(globalDefinition.getNode());
final AbstractType aliasedType = typeAnnotation != null ? this.typeParser.parseTypeString(typeAnnotation, globalDefinition.getPackage()) : UndefinedType.INSTANCE;
final AbstractType globalType = new AliasType(globalRef, aliasedType);
this.typeKeeper.addType(globalType);
final Path path = Paths.get(magikFile.getUri());
this.indexedTypes.get(path).add(globalType);
}
Aggregations