Exemplo n.º 1
0
 public List<String> createAvailableTypes() {
   if (this.myType == null) {
     List<String> result = ListSequence.fromList(new ArrayList<String>());
     return result;
   }
   SubtypingManager manager = TypeChecker.getInstance().getSubtypingManager();
   StructuralNodeSet<?> frontier = new StructuralNodeSet();
   List<SNode> found = new ArrayList<SNode>();
   frontier.add(this.myType);
   while (!(frontier.isEmpty())) {
     StructuralNodeSet<?> ancestors = new StructuralNodeSet();
     for (SNode node : SetSequence.fromSet(frontier)) {
       ancestors.addAllStructurally(manager.collectImmediateSupertypes(node, false));
       ListSequence.fromList(found).addElement(node);
     }
     for (SNode passed : ListSequence.fromList(found)) {
       ancestors.removeStructurally(passed);
     }
     frontier = ancestors;
   }
   List<String> result = ListSequence.fromList(new ArrayList<String>());
   for (SNode node : ListSequence.fromList(found)) {
     ListSequence.fromList(result).addElement(node.toString());
     MapSequence.fromMap(this.myTypesMap).put(node.toString(), node);
   }
   return result;
 }
Exemplo n.º 2
0
 public MethodParameter(SNode variable, SNode type, String name, SNode reference) {
   this.myDeclaration = variable;
   this.myType = type;
   if (type != null) {
     this.setTypeName(type.toString());
   } else {
     this.setTypeName("null");
   }
   this.setName(name);
   this.myVariableReference =
       SNodeOperations.cast(reference, "jetbrains.mps.baseLanguage.structure.Expression");
   this.myAvailableTypes = this.createAvailableTypes();
 }