The root of all contracts

Introduced properties

private abstract fun adapt_method_to_contract(v: ContractsVisitor, mfacet: MFacet, n_mpropdef: AMethPropdef)

nitc :: MContract :: adapt_method_to_contract

Method to adapt the given n_mpropdef.n_block to the contract
private fun adapt_msignature(m_signature: nullable MSignature): MSignature

nitc :: MContract :: adapt_msignature

Adapt the m_signature to the contract
private fun adapt_nsignature(n_signature: nullable ASignature): ASignature

nitc :: MContract :: adapt_nsignature

Adapt the n_signature to the contract
private fun adapt_specific_msignature(m_signature: MSignature): MSignature

nitc :: MContract :: adapt_specific_msignature

Create and return an adapted MSignature specifically for the contract in fonction of the given m_signature
private fun adapt_specific_nsignature(n_signature: ASignature): ASignature

nitc :: MContract :: adapt_specific_nsignature

Create and return an adapted ASignature specifically for the contract in fonction of the given n_signature
private abstract fun create_inherit_nblock(v: ContractsVisitor, n_conditions: Array[AExpr], super_args: Array[AExpr]): ABlockExpr

nitc :: MContract :: create_inherit_nblock

Creating specific inheritance block contract
private fun create_intro_contract(v: ContractsVisitor, n_conditions: Array[AExpr], mclassdef: MClassDef)

nitc :: MContract :: create_intro_contract

Create the initial contract (intro)
private fun create_subcontract(v: ContractsVisitor, n_conditions: Array[AExpr], mclassdef: MClassDef)

nitc :: MContract :: create_subcontract

Create a contract to check the old (super call) and the new conditions
init defaultinit(intro_mclassdef: MClassDef, name: String, location: Location, visibility: MVisibility)

nitc :: MContract :: defaultinit

abstract fun is_already_applied(mfacet: MFacet): Bool

nitc :: MContract :: is_already_applied

Is the contract is it already applied on the given mfacet
private fun is_called(v: ContractsVisitor, mpropdef: MPropDef): Bool

nitc :: MContract :: is_called

Should contract be called?
private fun make_contract(v: ContractsVisitor, n_block: AExpr, mclassdef: MClassDef)

nitc :: MContract :: make_contract

Build a new contract method with a specific block n_block in a specified mclassdef
private fun no_intro_contract(v: ContractsVisitor, a: Array[AAnnotation])

nitc :: MContract :: no_intro_contract

Method use to diplay warning when the contract is not present at the introduction

Redefined properties

redef type SELF: MContract

nitc $ MContract :: SELF

Type of this instance, automatically specialized in every class

All properties

fun !=(other: nullable Object): Bool

core :: Object :: !=

Have self and other different values?
fun ==(other: nullable Object): Bool

core :: Object :: ==

Have self and other the same value?
type CLASS: Class[SELF]

core :: Object :: CLASS

The type of the class of self.
type MENTITY: SELF

nitc :: MEntity :: MENTITY

FIXME used to bypass RTA limitation on type resolution
type MPROPDEF: MPropDef

nitc :: MProperty :: MPROPDEF

The associated MPropDef subclass.
type SELF: Object

core :: Object :: SELF

Type of this instance, automatically specialized in every class
private var _c_name: String

nitc :: MProperty :: _c_name

private var _css_classes: Array[String]

nitc :: MEntity :: _css_classes

CSS classes used to decorate self
private var _deprecation: nullable MDeprecationInfo

nitc :: MEntity :: _deprecation

Is the entity deprecated?
private var _examples: Array[MExample]

nitc :: MEntity :: _examples

Examples found for self
private var _full_name: String

nitc :: MProperty :: _full_name

The canonical name of the property.
private var _getter_for: nullable MAttribute

nitc :: MMethod :: _getter_for

The attribute this getter is for
private var _html_full_name: String

nitc :: MEntity :: _html_full_name

The MEntity full_name escaped for HTML
private var _html_id: String

nitc :: MEntity :: _html_id

The MEntity unique ID in the HTML output
private var _html_name: String

nitc :: MEntity :: _html_name

The MEntity name escaped for HTML
private var _html_url: String

nitc :: MProperty :: _html_url

private var _html_url: String

nitc :: MEntity :: _html_url

The MEntity URL in the HTML output
private var _html_url: String

nitc :: MEntity :: _html_url

private var _intro: MPROPDEF

nitc :: MProperty :: _intro

The definition that introduces the property.
private var _intro_mclassdef: MClassDef

nitc :: MProperty :: _intro_mclassdef

The classdef that introduce the property
private var _is_after: Bool

nitc :: MProperty :: _is_after

Does self have the after annotation?
private var _is_after_all: Bool

nitc :: MProperty :: _is_after_all

Does self have the after_all annotation?
private var _is_autoinit: Bool

nitc :: MProperty :: _is_autoinit

Is the property usable as an initializer?
private var _is_before: Bool

nitc :: MProperty :: _is_before

Does self have the before annotation?
private var _is_before_all: Bool

nitc :: MProperty :: _is_before_all

Does self have the before_all annotation?
private var _is_broken: Bool

nitc :: MEntity :: _is_broken

The indication that the entity did not pass some semantic verifications.
private var _is_example: Bool

nitc :: MProperty :: _is_example

private var _is_fictive: Bool

nitc :: MEntity :: _is_fictive

Is self created for internal purpose?
private var _is_init: Bool

nitc :: MMethod :: _is_init

Is the property a constructor?
private var _is_new: Bool

nitc :: MMethod :: _is_new

Is the property a 'new' constructor?
private var _is_root_init: Bool

nitc :: MMethod :: _is_root_init

The constructor is a (the) root init with empty signature but a set of initializers
private var _is_test: Bool

nitc :: MEntity :: _is_test

Is self created for unit testing purpose?
private var _is_test: Bool

nitc :: MProperty :: _is_test

private var _is_toplevel: Bool

nitc :: MMethod :: _is_toplevel

Is the property defined at the top_level of the module?
private var _location: Location

nitc :: MProperty :: _location

private var _mcontract_facet: nullable MFacet

nitc :: MMethod :: _mcontract_facet

The contract facet of the method
private var _mdoc: nullable MDoc

nitc :: MEntity :: _mdoc

The documentation associated to the entity
private var _mensure: nullable MEnsure

nitc :: MMethod :: _mensure

The MEnsure contract if any
private var _mexample: nullable MExample

nitc :: MEntity :: _mexample

Return this entity as a MExample
private var _mexpect: nullable MExpect

nitc :: MMethod :: _mexpect

The MExpect contract if any
private var _mpropdefs: Array[MPROPDEF]

nitc :: MProperty :: _mpropdefs

All definitions of the property.
private var _name: String

nitc :: MProperty :: _name

The (short) name of the property
private var _offset: Int

nitc :: MMethod :: _offset

Relative offset of this method in the virtual table (from the beginning of the block)
private var _offset: Int

nitc :: MProperty :: _offset

Relative offset of this in the runtime instance
private var _restful_async: Bool

nitc :: MMethod :: _restful_async

Is this a restful method to be executed asynchronously
private var _restful_resources: Array[String]

nitc :: MMethod :: _restful_resources

Associated resources within an action, e.g. foo in http://localhost/foo?arg=bar
private var _restful_verbs: Array[String]

nitc :: MMethod :: _restful_verbs

HTTP access methods, e.g. GET
private var _setter_for: nullable MAttribute

nitc :: MMethod :: _setter_for

The attribute this setter is for
private var _visibility: MVisibility

nitc :: MProperty :: _visibility

The visibility of the property
protected fun accept_json_serializer(v: JsonSerializer)

serialization :: Serializable :: accept_json_serializer

Refinable service to customize the serialization of this class to JSON
protected fun accept_msgpack_attribute_counter(v: AttributeCounter)

serialization :: Serializable :: accept_msgpack_attribute_counter

Hook to customize the behavior of the AttributeCounter
protected fun accept_msgpack_serializer(v: MsgPackSerializer)

serialization :: Serializable :: accept_msgpack_serializer

Hook to customize the serialization of this class to MessagePack
private abstract fun adapt_method_to_contract(v: ContractsVisitor, mfacet: MFacet, n_mpropdef: AMethPropdef)

nitc :: MContract :: adapt_method_to_contract

Method to adapt the given n_mpropdef.n_block to the contract
private fun adapt_msignature(m_signature: nullable MSignature): MSignature

nitc :: MContract :: adapt_msignature

Adapt the m_signature to the contract
private fun adapt_nsignature(n_signature: nullable ASignature): ASignature

nitc :: MContract :: adapt_nsignature

Adapt the n_signature to the contract
private fun adapt_specific_msignature(m_signature: MSignature): MSignature

nitc :: MContract :: adapt_specific_msignature

Create and return an adapted MSignature specifically for the contract in fonction of the given m_signature
private fun adapt_specific_nsignature(n_signature: ASignature): ASignature

nitc :: MContract :: adapt_specific_nsignature

Create and return an adapted ASignature specifically for the contract in fonction of the given n_signature
private fun add_doc_to_infobox(res: HInfoBox)

nitc :: MEntity :: add_doc_to_infobox

Append an entry for the doc in the given infobox
protected fun add_to_bundle(bundle: NativeBundle, key: JavaString)

serialization :: Serializable :: add_to_bundle

Called by []= to dynamically choose the appropriate method according
fun api_url: String

nitc :: MEntity :: api_url

URL to self within the JSON api.
private fun build_c_implementation_signature(recv_mtype: MClassType, from_mmodule: MModule, suffix: nullable String, length: SignatureLength, call_context: CallContext): String

nitc :: MMethod :: build_c_implementation_signature

Similar to build_c_signature but adapted to create the signature expected by JNI for C functions
fun build_ccall(recv_mtype: MClassType, from_mmodule: MModule, suffix: nullable String, length: SignatureLength, call_context: CallContext, param_suffix: nullable String): String

nitc :: MMethod :: build_ccall

Build a C function call for the FFI implementation (uses friendly naming).
fun build_cname(recv_mtype: MClassType, from_mmodule: MModule, suffix: nullable String, length: SignatureLength): String

nitc :: MMethod :: build_cname

Build a C function name for the FFI implementation (uses friendly naming).
private fun build_contract_facet: MFacet

nitc :: MMethod :: build_contract_facet

Build mcontract_facet if is not exist and return it
fun build_csignature(recv_mtype: MClassType, from_mmodule: MModule, suffix: nullable String, length: SignatureLength, call_context: CallContext): String

nitc :: MMethod :: build_csignature

Build a C function signature for the FFI implementation (uses friendly naming).
private fun build_ensure: MEnsure

nitc :: MMethod :: build_ensure

Build mensure if is not exist and return it
private fun build_expect: MExpect

nitc :: MMethod :: build_expect

Build mexpect if is not exist and return it
private fun build_jni_format(recv_mtype: MClassType, from_mmodule: MModule): String

nitc :: MMethod :: build_jni_format

Returns the JNI signature format of this Nit method
abstract fun c_name: String

nitc :: MEntity :: c_name

A fully-qualified C-like identifier of this model entity.
protected fun c_name=(c_name: String)

nitc :: MProperty :: c_name=

protected fun class_factory(name: String): CLASS

core :: Object :: class_factory

Implementation used by get_class to create the specific class.
fun class_name: String

core :: Object :: class_name

The class name of the object.
fun collect_ancestors(mainmodule: MModule, filter: nullable ModelFilter): Set[MENTITY]

nitc :: MEntity :: collect_ancestors

Collect self ancestors (direct and indirect)
abstract fun collect_children(mainmodule: MModule, filter: nullable ModelFilter): Set[MENTITY]

nitc :: MEntity :: collect_children

Collect self children (direct descendants)
fun collect_descendants(mainmodule: MModule, filter: nullable ModelFilter): Set[MENTITY]

nitc :: MEntity :: collect_descendants

Collect self descendants (direct and direct)
fun collect_linearization(mainmodule: MModule): nullable Array[MEntity]

nitc :: MEntity :: collect_linearization

Collect self linearization anchored on mainmodule
fun collect_modifiers: Array[String]

nitc :: MEntity :: collect_modifiers

Collect modifier keywords like redef, private etc
fun collect_mpropdefs(filter: nullable ModelFilter): Set[MPropDef]

nitc :: MProperty :: collect_mpropdefs

Collect all property definitions of self
abstract fun collect_parents(mainmodule: MModule, filter: nullable ModelFilter): Set[MENTITY]

nitc :: MEntity :: collect_parents

Collect self parents (direct ancestors)
fun color: String

nitc :: MEntity :: color

private fun complete_mdoc: nullable MDoc

nitc :: MEntity :: complete_mdoc

Doc to use in completion
private fun complete_name: String

nitc :: MEntity :: complete_name

Actual name used in completion
protected fun const_color=(const_color: String)

nitc :: MEntity :: const_color=

fun core_serialize_to(serializer: Serializer)

serialization :: Serializable :: core_serialize_to

Actual serialization of self to serializer
abstract fun create_ast_representation(astbuilder: nullable ASTBuilder): ANode

nitc :: MEntity :: create_ast_representation

Build a ANode from self
private fun create_facet(v: ContractsVisitor, classdef: MClassDef, facet: MFacet, called: MMethod): AMethPropdef

nitc :: MMethod :: create_facet

Method to create a facet of the method.
private abstract fun create_inherit_nblock(v: ContractsVisitor, n_conditions: Array[AExpr], super_args: Array[AExpr]): ABlockExpr

nitc :: MContract :: create_inherit_nblock

Creating specific inheritance block contract
private fun create_intro_contract(v: ContractsVisitor, n_conditions: Array[AExpr], mclassdef: MClassDef)

nitc :: MContract :: create_intro_contract

Create the initial contract (intro)
private fun create_subcontract(v: ContractsVisitor, n_conditions: Array[AExpr], mclassdef: MClassDef)

nitc :: MContract :: create_subcontract

Create a contract to check the old (super call) and the new conditions
fun cs_comment(no_color: nullable Bool): nullable String

nitc :: MEntity :: cs_comment

Returns the comment of this MEntity formatted for console.
fun cs_declaration(no_color: nullable Bool): String

nitc :: MEntity :: cs_declaration

Returns the complete MEntity declaration (modifiers + name + signature).
fun cs_full_name(no_color: nullable Bool): String

nitc :: MEntity :: cs_full_name

Returns self.full_name formatted for console
fun cs_icon(no_color: nullable Bool): String

nitc :: MEntity :: cs_icon

Text icon to be displayed in front of the entity
fun cs_list_item(no_color: nullable Bool): String

nitc :: MEntity :: cs_list_item

Returns self as a list element that can be displayed in console.
fun cs_location(no_color: nullable Bool): String

nitc :: MEntity :: cs_location

Source code location of this MEntity formatted for console
fun cs_short_comment(no_color: nullable Bool): nullable String

nitc :: MEntity :: cs_short_comment

Returns the comment of this MEntity formatted for console.
fun cs_signature(no_color: nullable Bool): String

nitc :: MEntity :: cs_signature

Returns self signature formatted for console.
fun cs_source_code: String

nitc :: MEntity :: cs_source_code

Source code associated to this MEntity.
fun css_classes: Array[String]

nitc :: MEntity :: css_classes

CSS classes used to decorate self
protected fun css_classes=(css_classes: Array[String])

nitc :: MEntity :: css_classes=

CSS classes used to decorate self
init defaultinit(intro_mclassdef: MClassDef, name: String, location: Location, visibility: MVisibility)

nitc :: MMethod :: defaultinit

init defaultinit(intro_mclassdef: MClassDef, name: String, location: Location, visibility: MVisibility)

nitc :: MContract :: defaultinit

init defaultinit(intro_mclassdef: MClassDef, name: String, location: Location, visibility: MVisibility)

nitc :: MProperty :: defaultinit

private fun define_contract_facet(v: ContractsVisitor, classdef: MClassDef, mcontract: nullable MContract)

nitc :: MMethod :: define_contract_facet

Define contract facet for MMethod in the given mclassdef. The facet represents the entry point with contracts (expect, ensure) of the method.
fun deprecation: nullable MDeprecationInfo

nitc :: MEntity :: deprecation

Is the entity deprecated?
fun deprecation=(deprecation: nullable MDeprecationInfo)

nitc :: MEntity :: deprecation=

Is the entity deprecated?
fun examples: Array[MExample]

nitc :: MEntity :: examples

Examples found for self
protected fun examples=(examples: Array[MExample])

nitc :: MEntity :: examples=

Examples found for self
init from_deserializer(deserializer: Deserializer)

serialization :: Serializable :: from_deserializer

Create an instance of this class from the deserializer
abstract fun full_name: String

nitc :: MEntity :: full_name

A fully-qualified name of this model entity.
protected fun full_name=(full_name: String)

nitc :: MProperty :: full_name=

The canonical name of the property.
fun get_class: CLASS

core :: Object :: get_class

The meta-object representing the dynamic type of self.
fun getter_for: nullable MAttribute

nitc :: MMethod :: getter_for

The attribute this getter is for
fun getter_for=(getter_for: nullable MAttribute)

nitc :: MMethod :: getter_for=

The attribute this getter is for
fun has_contract_facet: Bool

nitc :: MMethod :: has_contract_facet

Is there an contract facet?
fun has_ensure: Bool

nitc :: MMethod :: has_ensure

Is there an ensure contract?
fun has_expect: Bool

nitc :: MMethod :: has_expect

Is there an expect contract?
fun hash: Int

core :: Object :: hash

The hash code of the object.
fun hierarchy_poset(mainmodule: MModule, filter: nullable ModelFilter): POSet[MENTITY]

nitc :: MEntity :: hierarchy_poset

Build a poset representing self in it's own hierarchy
private fun href(v: NitlightVisitor): nullable String

nitc :: MEntity :: href

fun html_declaration: Template

nitc :: MEntity :: html_declaration

Returns the complete MEntity declaration decorated with HTML
fun html_full_name: String

nitc :: MEntity :: html_full_name

The MEntity full_name escaped for HTML
protected fun html_full_name=(html_full_name: String)

nitc :: MEntity :: html_full_name=

The MEntity full_name escaped for HTML
fun html_icon: BSIcon

nitc :: MEntity :: html_icon

An icon representative of the mentity
fun html_id: String

nitc :: MEntity :: html_id

The MEntity unique ID in the HTML output
protected fun html_id=(html_id: String)

nitc :: MEntity :: html_id=

The MEntity unique ID in the HTML output
fun html_name: String

nitc :: MEntity :: html_name

The MEntity name escaped for HTML
protected fun html_name=(html_name: String)

nitc :: MEntity :: html_name=

The MEntity name escaped for HTML
abstract fun html_namespace: Template

nitc :: MEntity :: html_namespace

Returns full_name decorated with HTML links
fun html_signature(short: nullable Bool): Template

nitc :: MEntity :: html_signature

Returns the MEntity signature decorated with HTML
fun html_url: String

nitc :: MEntity :: html_url

The MEntity URL in the HTML output
protected fun html_url=(html_url: String)

nitc :: MEntity :: html_url=

The MEntity URL in the HTML output
abstract fun infobox(v: HtmlightVisitor): HInfoBox

nitc :: HInfoBoxable :: infobox

An new infobox documenting the entity
init init

core :: Object :: init

fun inspect: String

core :: Object :: inspect

Developer readable representation of self.
protected fun inspect_head: String

core :: Object :: inspect_head

Return "CLASSNAME:#OBJECTID".
fun intro: MPROPDEF

nitc :: MProperty :: intro

The definition that introduces the property.
protected fun intro=(intro: MPROPDEF)

nitc :: MProperty :: intro=

The definition that introduces the property.
fun intro_mclassdef: MClassDef

nitc :: MProperty :: intro_mclassdef

The classdef that introduce the property
protected fun intro_mclassdef=(intro_mclassdef: MClassDef)

nitc :: MProperty :: intro_mclassdef=

The classdef that introduce the property
fun is_accessor: Bool

nitc :: MMethod :: is_accessor

Is this method a getter or a setter?
fun is_after: Bool

nitc :: MProperty :: is_after

Does self have the after annotation?
protected fun is_after=(is_after: Bool)

nitc :: MProperty :: is_after=

Does self have the after annotation?
fun is_after_all: Bool

nitc :: MProperty :: is_after_all

Does self have the after_all annotation?
protected fun is_after_all=(is_after_all: Bool)

nitc :: MProperty :: is_after_all=

Does self have the after_all annotation?
abstract fun is_already_applied(mfacet: MFacet): Bool

nitc :: MContract :: is_already_applied

Is the contract is it already applied on the given mfacet
fun is_autoinit: Bool

nitc :: MProperty :: is_autoinit

Is the property usable as an initializer?
fun is_autoinit=(is_autoinit: Bool)

nitc :: MProperty :: is_autoinit=

Is the property usable as an initializer?
fun is_before: Bool

nitc :: MProperty :: is_before

Does self have the before annotation?
protected fun is_before=(is_before: Bool)

nitc :: MProperty :: is_before=

Does self have the before annotation?
fun is_before_all: Bool

nitc :: MProperty :: is_before_all

Does self have the before_all annotation?
protected fun is_before_all=(is_before_all: Bool)

nitc :: MProperty :: is_before_all=

Does self have the before_all annotation?
fun is_broken: Bool

nitc :: MEntity :: is_broken

The indication that the entity did not pass some semantic verifications.
fun is_broken=(is_broken: Bool)

nitc :: MEntity :: is_broken=

The indication that the entity did not pass some semantic verifications.
private fun is_called(v: ContractsVisitor, mpropdef: MPropDef): Bool

nitc :: MContract :: is_called

Should contract be called?
fun is_example: Bool

nitc :: MEntity :: is_example

Is self existing for an example purpose?
protected fun is_example=(is_example: Bool)

nitc :: MProperty :: is_example=

fun is_fictive: Bool

nitc :: MEntity :: is_fictive

Is self created for internal purpose?
fun is_fictive=(is_fictive: Bool)

nitc :: MEntity :: is_fictive=

Is self created for internal purpose?
fun is_getter: Bool

nitc :: MMethod :: is_getter

Is this method a getter (auto or not)?
fun is_init: Bool

nitc :: MMethod :: is_init

Is the property a constructor?
fun is_init=(is_init: Bool)

nitc :: MMethod :: is_init=

Is the property a constructor?
fun is_init_for(mclass: MClass): Bool

nitc :: MMethod :: is_init_for

Is the property a legal constructor for a given class?
fun is_new: Bool

nitc :: MMethod :: is_new

Is the property a 'new' constructor?
fun is_new=(is_new: Bool)

nitc :: MMethod :: is_new=

Is the property a 'new' constructor?
fun is_null_safe: Bool

nitc :: MMethod :: is_null_safe

A specific method that is safe to call on null.
fun is_root_init: Bool

nitc :: MMethod :: is_root_init

The constructor is a (the) root init with empty signature but a set of initializers
fun is_root_init=(is_root_init: Bool)

nitc :: MMethod :: is_root_init=

The constructor is a (the) root init with empty signature but a set of initializers
intern fun is_same_instance(other: nullable Object): Bool

core :: Object :: is_same_instance

Return true if self and other are the same instance (i.e. same identity).
fun is_same_serialized(other: nullable Object): Bool

core :: Object :: is_same_serialized

Is self the same as other in a serialization context?
intern fun is_same_type(other: Object): Bool

core :: Object :: is_same_type

Return true if self and other have the same dynamic type.
fun is_setter: Bool

nitc :: MMethod :: is_setter

Is this method a setter (auto or not)?
fun is_test: Bool

nitc :: MEntity :: is_test

Is self created for unit testing purpose?
fun is_test=(is_test: Bool)

nitc :: MEntity :: is_test=

Is self created for unit testing purpose?
fun is_toplevel: Bool

nitc :: MMethod :: is_toplevel

Is the property defined at the top_level of the module?
fun is_toplevel=(is_toplevel: Bool)

nitc :: MMethod :: is_toplevel=

Is the property defined at the top_level of the module?
private fun jname: String

nitc :: MEntity :: jname

A Java compatible name for self
abstract fun json_namespace: JsonNamespace

nitc :: MEntity :: json_namespace

Return self.full_name as an object that can be serialized to json.
fun linkto(v: HtmlightVisitor): HTMLTag

nitc :: MEntity :: linkto

A HTML version of to_s with hyper-links.
fun linkto_text(v: HtmlightVisitor, text: String): HTMLTag

nitc :: MEntity :: linkto_text

Link to the self with a specific text.
fun location: Location

nitc :: MEntity :: location

The origin of the definition.
protected fun location=(location: Location)

nitc :: MProperty :: location=

fun lookup_all_definitions(mmodule: MModule, mtype: MType): Array[MPROPDEF]

nitc :: MProperty :: lookup_all_definitions

Return all definitions in a linearization order
fun lookup_definitions(mmodule: MModule, mtype: MType): Array[MPROPDEF]

nitc :: MProperty :: lookup_definitions

Return the most specific property definitions defined or inherited by a type.
fun lookup_first_definition(mmodule: MModule, mtype: MType): MPROPDEF

nitc :: MProperty :: lookup_first_definition

Return the most specific definition in the linearization of mtype.
fun lookup_super_definitions(mmodule: MModule, mtype: MType): Array[MPROPDEF]

nitc :: MProperty :: lookup_super_definitions

Return the most specific property definitions inherited by a type.
private fun make_contract(v: ContractsVisitor, n_block: AExpr, mclassdef: MClassDef)

nitc :: MContract :: make_contract

Build a new contract method with a specific block n_block in a specified mclassdef
private fun make_node(nodes: HashMap[MEntity, NeoNode], model_name: nullable String): NeoNode

nitc :: MEntity :: make_node

Make a new NeoNode based on mentity.
fun mcontract_facet: nullable MFacet

nitc :: MMethod :: mcontract_facet

The contract facet of the method
protected fun mcontract_facet=(mcontract_facet: nullable MFacet)

nitc :: MMethod :: mcontract_facet=

The contract facet of the method
fun mdoc: nullable MDoc

nitc :: MEntity :: mdoc

The documentation associated to the entity
fun mdoc=(mdoc: nullable MDoc)

nitc :: MEntity :: mdoc=

The documentation associated to the entity
fun mdoc_or_fallback: nullable MDoc

nitc :: MEntity :: mdoc_or_fallback

The documentation associated to the entity or their main nested entity.
fun mensure: nullable MEnsure

nitc :: MMethod :: mensure

The MEnsure contract if any
protected fun mensure=(mensure: nullable MEnsure)

nitc :: MMethod :: mensure=

The MEnsure contract if any
private fun mentity_kind_rank: Int

nitc :: MEntity :: mentity_kind_rank

Compare MEntity class kind
fun mexample: nullable MExample

nitc :: MEntity :: mexample

Return this entity as a MExample
protected fun mexample=(mexample: nullable MExample)

nitc :: MEntity :: mexample=

Return this entity as a MExample
fun mexpect: nullable MExpect

nitc :: MMethod :: mexpect

The MExpect contract if any
protected fun mexpect=(mexpect: nullable MExpect)

nitc :: MMethod :: mexpect=

The MExpect contract if any
abstract fun model: Model

nitc :: MEntity :: model

A Model Entity has a direct link to its model
fun mpropdefs: Array[MPROPDEF]

nitc :: MProperty :: mpropdefs

All definitions of the property.
protected fun mpropdefs=(mpropdefs: Array[MPROPDEF])

nitc :: MProperty :: mpropdefs=

All definitions of the property.
protected fun msgpack_extra_array_items: Int

serialization :: Serializable :: msgpack_extra_array_items

Hook to request a larger than usual metadata array
abstract fun name: String

nitc :: MEntity :: name

The short (unqualified) name of this model entity.
protected fun name=(name: String)

nitc :: MProperty :: name=

The (short) name of the property
private intern fun native_class_name: CString

core :: Object :: native_class_name

The class name of the object in CString format.
abstract fun nitdoc_breadcrumbs: Array[MEntity]

nitc :: MEntity :: nitdoc_breadcrumbs

MEntities composing the breadcrumbs of a nitdoc page
protected fun nitdoc_breadcrumbs=(nitdoc_breadcrumbs: Array[MEntity])

nitc :: MProperty :: nitdoc_breadcrumbs=

private fun no_intro_contract(v: ContractsVisitor, a: Array[AAnnotation])

nitc :: MContract :: no_intro_contract

Method use to diplay warning when the contract is not present at the introduction
intern fun object_id: Int

core :: Object :: object_id

An internal hash code for the object based on its identity.
fun offset: Int

nitc :: MProperty :: offset

Relative offset of this in the runtime instance
protected fun offset=(offset: Int)

nitc :: MProperty :: offset=

Relative offset of this in the runtime instance
fun output

core :: Object :: output

Display self on stdout (debug only).
intern fun output_class_name

core :: Object :: output_class_name

Display class name on stdout (debug only).
fun ratings(config: NitwebConfig, user: nullable String): JsonObject

nitc :: MEntity :: ratings

Get the ratings of a mentity
fun ratings_by_dimension(config: NitwebConfig, dimension: String, user: nullable String): JsonObject

nitc :: MEntity :: ratings_by_dimension

Get the ratings of a dimension
private fun restful_async: Bool

nitc :: MMethod :: restful_async

Is this a restful method to be executed asynchronously
private fun restful_async=(restful_async: Bool)

nitc :: MMethod :: restful_async=

Is this a restful method to be executed asynchronously
private fun restful_resources: Array[String]

nitc :: MMethod :: restful_resources

Associated resources within an action, e.g. foo in http://localhost/foo?arg=bar
private fun restful_resources=(restful_resources: Array[String])

nitc :: MMethod :: restful_resources=

Associated resources within an action, e.g. foo in http://localhost/foo?arg=bar
private fun restful_verbs: Array[String]

nitc :: MMethod :: restful_verbs

HTTP access methods, e.g. GET
private fun restful_verbs=(restful_verbs: Array[String])

nitc :: MMethod :: restful_verbs=

HTTP access methods, e.g. GET
private fun select_most_specific(mmodule: MModule, candidates: Array[MPROPDEF]): Array[MPROPDEF]

nitc :: MProperty :: select_most_specific

Return an array containing olny the most specific property definitions
fun serialization_hash: Int

core :: Object :: serialization_hash

Hash value use for serialization
fun serialize_msgpack(plain: nullable Bool): Bytes

serialization :: Serializable :: serialize_msgpack

Serialize self to MessagePack bytes
fun serialize_to(serializer: Serializer)

serialization :: Serializable :: serialize_to

Serialize self to serializer
fun serialize_to_json(plain: nullable Bool, pretty: nullable Bool): String

serialization :: Serializable :: serialize_to_json

Serialize self to JSON
private fun serialize_to_or_delay(v: Serializer)

serialization :: Serializable :: serialize_to_or_delay

Accept references or force direct serialization (using serialize_to)
fun setter_for: nullable MAttribute

nitc :: MMethod :: setter_for

The attribute this setter is for
fun setter_for=(setter_for: nullable MAttribute)

nitc :: MMethod :: setter_for=

The attribute this setter is for
fun short_cname: String

nitc :: MMethod :: short_cname

Short name of this method in C (without the class name)
private fun source_url(url_pattern: nullable String): String

nitc :: MEntity :: source_url

Render a HTML link for the MEntity location
intern fun sys: Sys

core :: Object :: sys

Return the global sys object, the only instance of the Sys class.
fun to_dot_node: DotNode

nitc :: MEntity :: to_dot_node

Return self as a DotNode
fun to_json: String

serialization :: Serializable :: to_json

Serialize self to plain JSON
fun to_json_ref: MEntityRef

nitc :: MEntity :: to_json_ref

Return a new MEntityRef to self.
abstract fun to_jvalue(env: JniEnv): JValue

core :: Object :: to_jvalue

private fun to_node(nodes: HashMap[MEntity, NeoNode], model_name: nullable String): NeoNode

nitc :: MEntity :: to_node

Build a NeoNode representing self.
fun to_pretty_json: String

serialization :: Serializable :: to_pretty_json

Serialize self to plain pretty JSON
fun to_s: String

core :: Object :: to_s

User readable representation of self.
abstract fun tpl_class(model: UMLModel): Writable

nitc :: MEntity :: tpl_class

Generates a dot-compatible Writable UML Class diagram from self
abstract fun tpl_module(model: UMLModel): Writable

nitc :: MEntity :: tpl_module

Builds a dot UML package diagram entity from self
fun visibility: MVisibility

nitc :: MEntity :: visibility

The visibility of the MEntity.
protected fun visibility=(visibility: MVisibility)

nitc :: MProperty :: visibility=

The visibility of the property
fun visit_all(v: ModelVisitor)

nitc :: MEntity :: visit_all

Call v.enter_visit on all nested entities.
fun web_url: String

nitc :: MEntity :: web_url

URL to self within the web interface.
private fun write_doc(model: Model, mainmodule: MModule, stream: Writer)

nitc :: MEntity :: write_doc

private fun write_extra_doc(model: Model, mainmodule: MModule, stream: Writer)

nitc :: MEntity :: write_extra_doc

Extra auto documentation to append to the stream
private fun write_location(mainmodule: MModule, stream: Writer)

nitc :: MEntity :: write_location

Location (file and line when available) of related declarations
private fun write_synopsis(mainmodule: MModule, stream: Writer)

nitc :: MProperty :: write_synopsis

package_diagram nitc::MContract MContract nitc::MMethod MMethod nitc::MContract->nitc::MMethod nitc::MProperty MProperty nitc::MMethod->nitc::MProperty nitc::java_compiler::TableCallable TableCallable nitc::MMethod->nitc::java_compiler::TableCallable ...nitc::MProperty ... ...nitc::MProperty->nitc::MProperty ...nitc::java_compiler::TableCallable ... ...nitc::java_compiler::TableCallable->nitc::java_compiler::TableCallable nitc::MExpect MExpect nitc::MExpect->nitc::MContract nitc::BottomMContract BottomMContract nitc::BottomMContract->nitc::MContract nitc::MEnsure MEnsure nitc::MEnsure->nitc::BottomMContract nitc::MEnsure... ... nitc::MEnsure...->nitc::MEnsure

Ancestors

interface HInfoBoxable

nitc :: HInfoBoxable

Model entity or whatever that can produce an infobox
abstract class MEntity

nitc :: MEntity

A named and possibly documented entity in the model.
abstract class MProperty

nitc :: MProperty

A service (global property) that generalize method, attribute, etc.
interface Object

core :: Object

The root of the class hierarchy.
interface Serializable

serialization :: Serializable

Instances of this class can be passed to Serializer::serialize
private interface TableCallable

nitc :: TableCallable

Used as a common type between MMethod and MMethodDef for table_send

Parents

class MMethod

nitc :: MMethod

A global method

Children

abstract class BottomMContract

nitc :: BottomMContract

The root of all contracts where the call is after the execution of the original method (invariant and ensure).
class MExpect

nitc :: MExpect

An expect (precondition) contract representation

Descendants

class MEnsure

nitc :: MEnsure

A ensure (postcondition) representation

Class definitions

nitc $ MContract
# The root of all contracts
abstract class MContract
	super MMethod

	# Is the contract is it already applied on the given `mfacet`
	fun is_already_applied(mfacet: MFacet): Bool is abstract
end
src/model/model_contract.nit:21,1--27,3

nitc :: contracts $ MContract
redef class MContract

	# Should contract be called?
	# return `true` if the contract needs to be called.
	private fun is_called(v: ContractsVisitor, mpropdef: MPropDef): Bool
	do
		return v.toolcontext.opt_full_contract.value
	end

	# Method use to diplay warning when the contract is not present at the introduction
	private fun no_intro_contract(v: ContractsVisitor, a: Array[AAnnotation])do end

	# Creating specific inheritance block contract
	#
	# `super_args` : Correspond to the `super` call arguments
	private fun create_inherit_nblock(v: ContractsVisitor, n_conditions: Array[AExpr], super_args: Array[AExpr]): ABlockExpr is abstract

	# Method to adapt the given `n_mpropdef.n_block` to the contract
	private fun adapt_method_to_contract(v: ContractsVisitor, mfacet: MFacet, n_mpropdef: AMethPropdef) is abstract

	# Create and return an adapted `MSignature` specifically for the contract in fonction of the given `m_signature`
	private fun adapt_specific_msignature(m_signature: MSignature): MSignature do return m_signature.adapt_to_contract

	# Create and return an adapted `ASignature` specifically for the contract in fonction of the given `n_signature`
	private fun adapt_specific_nsignature(n_signature: ASignature): ASignature do return n_signature.adapt_to_contract

	# Adapt the `m_signature` to the contract
	# If `m_signature == null` return a new `MSignature` else it calls a specific adapt method see `adapt_specific_msignature`
	private fun adapt_msignature(m_signature: nullable MSignature): MSignature
	do
		if m_signature == null then return new MSignature(new Array[MParameter])
		return adapt_specific_msignature(m_signature)
	end

	# Adapt the `n_signature` to the contract
	# If `n_signature == null` return a new `ASignature` else it calls a specific adapt method see `adapt_specific_nsignature`
	private fun adapt_nsignature(n_signature: nullable ASignature): ASignature
	do
		if n_signature == null then return new ASignature
		return adapt_specific_nsignature(n_signature)
	end

	# Create the initial contract (intro)
	# All contracts have the same implementation for the introduction.
	#
	# Example:
	# ~~~nitish
	# fun contrat([...])
	# do
	#	assert contract_condition
	# end
	# ~~~
	#
	private fun create_intro_contract(v: ContractsVisitor, n_conditions: Array[AExpr], mclassdef: MClassDef)
	do
		var n_block = v.ast_builder.make_block
		for n_condition in n_conditions do
			# Create a new tid to set the name of the assert for more explicit error
			var tid = new TId.init_tk(n_condition.location)
			tid.text = "{n_condition.location.text}"
			var n_assert = v.ast_builder.make_assert(tid, n_condition, null)
			# Define the assert location to reference the annoation
			n_assert.location = n_condition.location
			n_block.add n_assert
		end
		make_contract(v, n_block, mclassdef)
	end

	# Create a contract to check the old (super call) and the new conditions
	#
	# Example:
	# ~~~nitish
	# fun contrat([...])
	# do
	#	super # Call the old contracts
	#	assert new_condition
	# end
	# ~~~
	#
	private fun create_subcontract(v: ContractsVisitor, n_conditions: Array[AExpr], mclassdef: MClassDef)
	do
		var args = v.n_signature.make_parameter_read(v.ast_builder)
		var n_block = v.ast_builder.make_block
		n_block = self.create_inherit_nblock(v, n_conditions, args)
		make_contract(v, n_block, mclassdef)
	end

	# Build a new contract method with a specific block `n_block` in a specified `mclassdef`
	private fun make_contract(v: ContractsVisitor, n_block: AExpr, mclassdef: MClassDef)
	do
		var n_contractdef = v.toolcontext.modelbuilder.create_method_from_property(self, mclassdef, false, v.m_signature)
		# Set the signature to keep the same variable
		n_contractdef.n_signature = v.n_signature
		n_contractdef.n_block = n_block
		# Define the location of the new method for corresponding of the annotation location
		n_contractdef.location = v.current_location
		n_contractdef.do_all(v.toolcontext)
	end
end
src/contracts.nit:272,1--370,3