nitc :: VarDef :: defaultinit
# A Variable definition.
#
# Associates a variable to the location of its definition.
class VarDef
super Comparable
redef type OTHER: VarDef
# Variable this definition is about.
var variable: Variable
# Location of this definition in the source code.
var location: Location
redef fun ==(o) do
return o isa OTHER and variable == o.variable and location == o.location
end
redef fun <=>(o) do
if variable.name == o.variable.name then
return location.line_start <=> o.location.line_start
else
return variable.name <=> o.variable.name
end
end
redef fun hash do return variable.hash + location.hash
redef fun to_s do return "\{{variable}: {location.line_start}\}"
end
src/saf/reaching_defs.nit:117,1--145,3