示例#1
0
  @Override
  public void resolve(MarkerList markers, IContext context) {
    super.resolve(markers, context);

    if (this.value != null) {
      this.value = this.value.resolve(markers, context);
    }

    boolean inferType = false;
    ;
    if (this.type == Types.UNKNOWN) {
      inferType = true;
      this.type = this.value.getType();
      if (this.type == Types.UNKNOWN) {
        markers.add(this.position, "variable.type.infer", this.name.unqualified);
        this.type = Types.ANY;
      }
    }

    IValue value1 = this.value.withType(this.type, this.type, markers, context);
    if (value1 == null) {
      Marker marker = markers.create(this.position, "variable.type", this.name.unqualified);
      marker.addInfo("Variable Type: " + this.type);
      marker.addInfo("Value Type: " + this.value.getType());
    } else {
      this.value = value1;
      if (inferType) {
        this.type = value1.getType();
      }
    }
  }
示例#2
0
  @Override
  public IValue resolve(MarkerList markers, IContext context) {
    if (this.instance != null) {
      this.instance = this.instance.resolve(markers, context);
    }

    IValue v = this.resolveFieldAccess(markers, context);
    if (v != null) {
      return v;
    }

    Marker marker = markers.create(this.position, "resolve.method_field", this.name.unqualified);
    marker.addInfo("Qualified Name: " + this.name.qualified);
    if (this.instance != null) {
      marker.addInfo("Instance Type: " + this.instance.getType());
    }
    return this;
  }
示例#3
0
  @Override
  public IValue checkAssign(
      MarkerList markers,
      IContext context,
      ICodePosition position,
      IValue instance,
      IValue newValue) {
    if ((this.modifiers & Modifiers.FINAL) != 0) {
      markers.add(position, "variable.assign.final", this.name.unqualified);
    }

    IValue value1 = newValue.withType(this.type, null, markers, context);
    if (value1 == null) {
      Marker marker =
          markers.create(newValue.getPosition(), "variable.assign.type", this.name.unqualified);
      marker.addInfo("Variable Type: " + this.type);
      marker.addInfo("Value Type: " + newValue.getType());
    } else {
      newValue = value1;
    }

    return newValue;
  }