Beispiel #1
0
  @Override
  public SequenceType partiallyReplace(List<ModifiedType> values, List<ModifiedType> replacements) {
    SequenceType temp = new SequenceType();

    for (int i = 0; i < types.size(); i++) {
      ModifiedType type = types.get(i);
      if (type != null) {
        SimpleModifiedType dummy =
            new SimpleModifiedType(
                type.getType().partiallyReplace(values, replacements), type.getModifiers());
        temp.add(dummy);
      } else temp.add(null);
    }

    return temp;
  }
Beispiel #2
0
  public boolean canAccept(
      ModifiedType inputType, SubstitutionKind substitutionType, List<TypeCheckException> errors) {
    if (substitutionType.equals(SubstitutionKind.BINDING)) {
      SequenceType input = new SequenceType();
      input.add(inputType);
      return canAccept(input, substitutionType, errors);
    } else {
      if (inputType.getType() instanceof SequenceType)
        return canAccept((SequenceType) inputType.getType(), substitutionType, errors);

      // for splats
      for (ModifiedType modifiedType : types) {
        if (!BaseChecker.checkAssignment(
            modifiedType, inputType, AssignmentType.EQUAL, substitutionType, errors)) return false;
      }

      return true;
    }
  }
Beispiel #3
0
 /** List of return types */
 public SequenceType(ModifiedType type) {
   this();
   add(type);
 }
  public void addParameter(String name, ModifiedType type) {
    SequenceType parameterTypes = getType();

    parameterNames.add(name);
    parameterTypes.add(type);
  }