Merge: src/model: fix mdoc_or_fallback for MClasses and MProperties
authorJean Privat <jean@pryen.org>
Thu, 26 May 2016 15:43:33 +0000 (11:43 -0400)
committerJean Privat <jean@pryen.org>
Thu, 26 May 2016 15:43:33 +0000 (11:43 -0400)
Specify `mdoc_or_fallback` behavior in MClass and MProperty (return intro mdoc)

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

Pull-Request: #2124
Reviewed-by: Jean Privat <jean@pryen.org>

1  2 
src/model/model.nit

diff --combined src/model/model.nit
@@@ -30,15 -30,6 +30,15 @@@ import mdo
  import ordered_tree
  private import more_collections
  
 +redef class MEntity
 +      # The visibility of the MEntity.
 +      #
 +      # MPackages, MGroups and MModules are always public.
 +      # The visibility of `MClass` and `MProperty` is defined by the keyword used.
 +      # `MClassDef` and `MPropDef` return the visibility of `MClass` and `MProperty`.
 +      fun visibility: MVisibility do return public_visibility
 +end
 +
  redef class Model
        # All known classes
        var mclasses = new Array[MClass]
@@@ -474,7 -465,7 +474,7 @@@ class MClas
  
        # The visibility of the class
        # In Nit, the visibility of a class cannot evolve in refinements
 -      var visibility: MVisibility
 +      redef var visibility
  
        init
        do
  
        # Is `self` and abstract class?
        var is_abstract: Bool is lazy do return kind == abstract_kind
+       redef fun mdoc_or_fallback do return intro.mdoc_or_fallback
  end
  
  
@@@ -602,8 -595,6 +604,8 @@@ class MClassDe
  
        redef var location: Location
  
 +      redef fun visibility do return mclass.visibility
 +
        # Internal name combining the module and the class
        # Example: "mymodule$MyClass"
        redef var to_s is noinit
@@@ -1974,6 -1965,8 +1976,8 @@@ abstract class MPropert
  
        redef var location
  
+       redef fun mdoc_or_fallback do return intro.mdoc_or_fallback
        # The canonical name of the property.
        #
        # It is currently the short-`name` prefixed by the short-name of the class and the full-name of the module.
        end
  
        # The visibility of the property
 -      var visibility: MVisibility
 +      redef var visibility
  
        # Is the property usable as an initializer?
        var is_autoinit = false is writable
@@@ -2266,8 -2259,6 +2270,8 @@@ abstract class MPropDe
  
        redef var location: Location
  
 +      redef fun visibility do return mproperty.visibility
 +
        init
        do
                mclassdef.mpropdefs.add(self)