Merge: Abstract attribute
authorJean Privat <jean@pryen.org>
Tue, 10 Mar 2015 13:51:12 +0000 (20:51 +0700)
committerJean Privat <jean@pryen.org>
Tue, 10 Mar 2015 13:51:12 +0000 (20:51 +0700)
commitd66b06f17fddd8045368ba5f5b483915582cbd64
tree33e6a05f7af93f132381b85eea6b930387766000
parent111d93a28c270cd22229d12faef3ba52fb74c476
parentc302ce2ed861df41f027acd3900146e8f5096bcc
Merge: Abstract attribute

Add the annotation `abstract` on attributes.

It is just a syntactic sugar to define a couple of abstract getter-setters with a shared documentation without an associated slot in the instance so it can be used in interfaces.

~~~nit
interface Foo
var a: Object is abstract
end

class Bar
super Foo
         # A concrete attribute that redefine the abstract one
redef var a
end

class Baz
super Foo
var real_a: Object
         # A pair of concrete methods that redefine the abstract attribute
redef fun a do return real_a
redef fun a=(x) do real_a = x
end
~~~

The visibility rules are unchanged with regard to concrete attributes, so by default the writer is private.

Needed cleaning (and a bugfix) are included in the PR

Pull-Request: #1177
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>
src/compiler/abstract_compiler.nit
src/modelize/modelize_property.nit
src/rapid_type_analysis.nit