use of nl.ramsolutions.sw.magik.analysis.typing.types.Package in project magik-tools by StevenLooman.
the class JsonTypeKeeperReader method handlePackage.
private void handlePackage(final JSONObject instruction) {
final String name = instruction.getString("name");
if (!this.typeKeeper.hasPackage(name)) {
final Package pakkage = new Package(name);
this.typeKeeper.addPackage(pakkage);
}
final Package pakkage = this.typeKeeper.getPackage(name);
instruction.getJSONArray("uses").forEach(useObj -> {
final String use = (String) useObj;
final Package usePackage = this.typeKeeper.getPackage(use);
pakkage.addUse(usePackage);
});
}
use of nl.ramsolutions.sw.magik.analysis.typing.types.Package in project magik-tools by StevenLooman.
the class TypeKeeper method hasType.
@Override
public boolean hasType(final GlobalReference globalReference) {
final String pakkageName = globalReference.getPakkage();
final Package pakkage = this.getPackage(pakkageName);
final String identifier = globalReference.getIdentifier();
return pakkage != null && pakkage.containsKey(identifier);
}
use of nl.ramsolutions.sw.magik.analysis.typing.types.Package in project magik-tools by StevenLooman.
the class TypeKeeper method addType.
@Override
public void addType(final AbstractType type) {
final GlobalReference globalRef = GlobalReference.of(type.getFullName());
final String pakkageName = globalRef.getPakkage();
final Package pakkage = this.getPackage(pakkageName);
final String identifier = globalRef.getIdentifier();
pakkage.put(identifier, type);
}
use of nl.ramsolutions.sw.magik.analysis.typing.types.Package in project magik-tools by StevenLooman.
the class TypeKeeper method registerRequiredTypes.
private void registerRequiredTypes() {
final Package swPakkage = this.getPackage("sw");
swPakkage.put("object", new ObjectType(GlobalReference.of("sw:object")));
swPakkage.put("unset", new IntrinsicType(GlobalReference.of("sw:unset")));
swPakkage.put("false", new IntrinsicType(GlobalReference.of("sw:false")));
swPakkage.put("maybe", new IntrinsicType(GlobalReference.of("sw:maybe")));
swPakkage.put("integer", new IntrinsicType(GlobalReference.of("sw:integer")));
swPakkage.put("bignum", new IntrinsicType(GlobalReference.of("sw:bignum")));
swPakkage.put("float", new IntrinsicType(GlobalReference.of("sw:float")));
swPakkage.put("symbol", new IndexedType(GlobalReference.of("sw:symbol")));
swPakkage.put("character", new IntrinsicType(GlobalReference.of("sw:character")));
swPakkage.put("sw_regexp", new IntrinsicType(GlobalReference.of("sw:sw_regexp")));
swPakkage.put("char16_vector", new IndexedType(GlobalReference.of("sw:char16_vector")));
swPakkage.put("simple_vector", new IndexedType(GlobalReference.of("sw:simple_vector")));
swPakkage.put("heavy_thread", new IntrinsicType(GlobalReference.of("sw:heavy_thread")));
swPakkage.put("light_thread", new IntrinsicType(GlobalReference.of("sw:light_thread")));
swPakkage.put("condition", new SlottedType(GlobalReference.of("sw:condition")));
swPakkage.put("enumeration_value", new SlottedType(GlobalReference.of("sw:enumeration_value")));
swPakkage.put("indexed_format_mixin", new IntrinsicType(GlobalReference.of("sw:indexed_format_mixin")));
swPakkage.put("slotted_format_mixin", new IntrinsicType(GlobalReference.of("sw:slotted_format_mixin")));
}
use of nl.ramsolutions.sw.magik.analysis.typing.types.Package in project magik-tools by StevenLooman.
the class TypeKeeper method getType.
@Override
public AbstractType getType(final GlobalReference globalReference) {
final String pakkageName = globalReference.getPakkage();
final Package pakkage = this.getPackage(pakkageName);
final String identifier = globalReference.getIdentifier();
if (!pakkage.containsKey(identifier)) {
return UndefinedType.INSTANCE;
}
return pakkage.get(identifier);
}
Aggregations