Beispiel #1
0
  private Type getAttrType(@NotNull Type targetType) {
    List<Binding> bs = targetType.table.lookupAttr(attr.id);
    if (bs == null) {
      Analyzer.self.putProblem(attr, "attribute not found in type: " + targetType);
      Type t = Type.UNKNOWN;
      t.table.setPath(targetType.table.extendPath(attr.id));
      return t;
    } else {
      for (Binding b : bs) {
        Analyzer.self.putRef(attr, b);
        if (parent != null
            && parent.isCall()
            && b.type.isFuncType()
            && targetType.isInstanceType()) { // method call
          b.type.asFuncType().setSelfType(targetType);
        }
      }

      return State.makeUnion(bs);
    }
  }