Пример #1
0
  public List<QualifiedDefinition> caseAIsExp(AIsExp node, TypeCheckInfo question)
      throws AnalysisException {
    List<QualifiedDefinition> result = new Vector<QualifiedDefinition>();

    if (node.getTest() instanceof AVariableExp) {
      AVariableExp exp = (AVariableExp) node.getTest();
      PDefinition existing = question.env.findName(exp.getName(), NameScope.NAMESANDSTATE);

      if (existing != null && existing.getNameScope().matches(NameScope.NAMES)) {
        if (node.getBasicType() != null) {
          result.add(new QualifiedDefinition(existing, node.getBasicType()));
        } else if (node.getTypeName() != null) {
          if (node.getTypedef() == null) {
            PDefinition typedef =
                question.env.findType(node.getTypeName(), node.getLocation().getModule());
            node.setTypedef(typedef.clone());
          }

          if (node.getTypedef() != null) {
            result.add(new QualifiedDefinition(existing, node.getTypedef().getType()));
          }
        }
      }
    }

    return result;
  }