@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(); } } }
@Override public void check(MarkerList markers, IContext context) { super.check(markers, context); this.value.check(markers, context); if (this.type == Types.VOID) { markers.add(this.position, "variable.type.void"); } }
@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; }