nitc :: MEnsure :: defaultinit
nitc :: contracts $ MEnsure :: adapt_method_to_contract
Method to adapt the givenn_mpropdef.n_block
to the contract
nitc :: contracts $ MEnsure :: adapt_specific_msignature
Create and return an adaptedMSignature
specifically for the contract in fonction of the given m_signature
nitc :: contracts $ MEnsure :: adapt_specific_nsignature
Create and return an adaptedASignature
specifically for the contract in fonction of the given n_signature
nitc $ MEnsure :: is_already_applied
Is the contract is it already applied on the givenmfacet
nitc :: MEntity :: _const_color
nitc :: MEntity :: _css_classes
CSS classes used to decorateself
nitc :: MEntity :: _deprecation
Is the entity deprecated?nitc :: MMethod :: _getter_for
The attribute this getter is fornitc :: MEntity :: _html_full_name
The MEntityfull_name
escaped for HTML
nitc :: MProperty :: _intro_mclassdef
The classdef that introduce the propertynitc :: MProperty :: _is_after_all
Does self have theafter_all
annotation?
nitc :: MProperty :: _is_autoinit
Is the property usable as an initializer?nitc :: MProperty :: _is_before_all
Does self have thebefore_all
annotation?
nitc :: MEntity :: _is_broken
The indication that the entity did not pass some semantic verifications.nitc :: MProperty :: _is_example
nitc :: MMethod :: _is_root_init
The constructor is a (the) root init with empty signature but a set of initializersnitc :: MMethod :: _is_toplevel
Is the property defined at the top_level of the module?nitc :: MMethod :: _mcontract_facet
The contract facet of the methodnitc :: MProperty :: _mpropdefs
All definitions of the property.nitc :: MMethod :: _restful_async
Is this arestful
method to be executed asynchronously
nitc :: MMethod :: _restful_resources
Associated resources within an action, e.g.foo
in http://localhost/foo?arg=bar
nitc :: MMethod :: _restful_verbs
HTTP access methods, e.g.GET
nitc :: MMethod :: _setter_for
The attribute this setter is fornitc :: MProperty :: _visibility
The visibility of the propertyserialization :: Serializable :: accept_inspect_serializer_core
serialization :: Serializable :: accept_json_serializer
Refinable service to customize the serialization of this class to JSONserialization :: Serializable :: accept_msgpack_attribute_counter
Hook to customize the behavior of theAttributeCounter
serialization :: Serializable :: accept_msgpack_serializer
Hook to customize the serialization of this class to MessagePacknitc :: MContract :: adapt_method_to_contract
Method to adapt the givenn_mpropdef.n_block
to the contract
nitc :: MContract :: adapt_msignature
Adapt them_signature
to the contract
nitc :: MContract :: adapt_nsignature
Adapt then_signature
to the contract
nitc :: MContract :: adapt_specific_msignature
Create and return an adaptedMSignature
specifically for the contract in fonction of the given m_signature
nitc :: MContract :: adapt_specific_nsignature
Create and return an adaptedASignature
specifically for the contract in fonction of the given n_signature
nitc :: MEntity :: add_doc_to_infobox
Append an entry for the doc in the given infoboxserialization :: Serializable :: add_to_bundle
Called by[]=
to dynamically choose the appropriate method according
nitc :: MMethod :: build_c_implementation_signature
Similar tobuild_c_signature
but adapted to create the signature expected by JNI for C functions
nitc :: MMethod :: build_ccall
Build a C function call for the FFI implementation (uses friendly naming).nitc :: MMethod :: build_cname
Build a C function name for the FFI implementation (uses friendly naming).nitc :: MMethod :: build_contract_facet
Buildmcontract_facet
if is not exist and return it
nitc :: MMethod :: build_csignature
Build a C function signature for the FFI implementation (uses friendly naming).nitc :: MMethod :: build_ensure
Buildmensure
if is not exist and return it
nitc :: MMethod :: build_expect
Buildmexpect
if is not exist and return it
nitc :: MMethod :: build_jni_format
Returns the JNI signature format of this Nit methodcore :: Object :: class_factory
Implementation used byget_class
to create the specific class.
nitc :: MEntity :: collect_ancestors
Collectself
ancestors (direct and indirect)
nitc :: MEntity :: collect_children
Collectself
children (direct descendants)
nitc :: MEntity :: collect_descendants
Collectself
descendants (direct and direct)
nitc :: MEntity :: collect_linearization
Collectself
linearization anchored on mainmodule
nitc :: MEntity :: collect_metrics
nitc :: MEntity :: collect_modifiers
Collect modifier keywords likeredef
, private
etc
nitc :: MProperty :: collect_mpropdefs
Collect all property definitions ofself
nitc :: MEntity :: collect_parents
Collectself
parents (direct ancestors)
nitc :: MEntity :: const_color
nitc :: MEntity :: const_color=
nitc :: MEntity :: core_serialize_base
serialization :: Serializable :: core_serialize_to
Actual serialization ofself
to serializer
nitc :: MEntity :: create_ast_representation
Build a ANode fromself
nitc :: MMethod :: create_facet
Method to create a facet of the method.nitc :: MContract :: create_inherit_nblock
Creating specific inheritance block contractnitc :: MContract :: create_intro_contract
Create the initial contract (intro)nitc :: MContract :: create_subcontract
Create a contract to check the old (super call) and the new conditionsnitc :: MEntity :: cs_comment
Returns the comment of this MEntity formatted for console.nitc :: MEntity :: cs_declaration
Returns the complete MEntity declaration (modifiers + name + signature).nitc :: MEntity :: cs_full_name
Returnsself.full_name
formatted for console
nitc :: MEntity :: cs_list_item
Returnsself
as a list element that can be displayed in console.
nitc :: MEntity :: cs_location
Source code location of this MEntity formatted for consolenitc :: MEntity :: cs_short_comment
Returns the comment of this MEntity formatted for console.nitc :: MEntity :: cs_signature
Returnsself
signature formatted for console.
nitc :: MEntity :: cs_source_code
Source code associated to this MEntity.nitc :: MEntity :: css_classes=
CSS classes used to decorateself
nitc :: MMethod :: defaultinit
nitc :: BottomMContract :: defaultinit
nitc :: MContract :: defaultinit
nitc :: MEnsure :: defaultinit
nitc :: TableCallable :: defaultinit
nitc :: HInfoBoxable :: defaultinit
nitc :: MProperty :: defaultinit
core :: Object :: defaultinit
nitc :: MEntity :: defaultinit
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.nitc :: MEntity :: deprecation=
Is the entity deprecated?nitc :: MEntity :: field_separator
serialization :: Serializable :: from_deserializer
Create an instance of this class from thedeserializer
nitc :: MProperty :: full_name=
The canonical name of the property.nitc :: MMethod :: getter_for=
The attribute this getter is fornitc :: MEntity :: hierarchy_poset
Build a poset representingself
in it's own hierarchy
nitc :: MEntity :: html_declaration
Returns the complete MEntity declaration decorated with HTMLnitc :: MEntity :: html_full_name=
The MEntityfull_name
escaped for HTML
nitc :: MEntity :: html_name=
The MEntity name escaped for HTMLnitc :: MEntity :: html_namespace
Returnsfull_name
decorated with HTML links
nitc :: MEntity :: html_signature
Returns the MEntity signature decorated with HTMLnitc :: HInfoBoxable :: infobox
An new infobox documenting the entitynitc :: BottomMContract :: inject_result
Inject theresult
variable into the n_block
of the given n_mpropdef`.
nitc :: MProperty :: intro_mclassdef
The classdef that introduce the propertynitc :: MProperty :: intro_mclassdef=
The classdef that introduce the propertynitc :: MProperty :: is_after_all=
Does self have theafter_all
annotation?
nitc :: MContract :: is_already_applied
Is the contract is it already applied on the givenmfacet
nitc :: MProperty :: is_autoinit=
Is the property usable as an initializer?nitc :: MProperty :: is_before=
Does self have thebefore
annotation?
nitc :: MProperty :: is_before_all
Does self have thebefore_all
annotation?
nitc :: MProperty :: is_before_all=
Does self have thebefore_all
annotation?
nitc :: MEntity :: is_broken=
The indication that the entity did not pass some semantic verifications.nitc :: MProperty :: is_example=
nitc :: MEntity :: is_fictive=
Isself
created for internal purpose?
nitc :: MMethod :: is_init_for
Is the property a legal constructor for a given class?nitc :: MMethod :: is_null_safe
A specific method that is safe to call on null.nitc :: MMethod :: is_root_init
The constructor is a (the) root init with empty signature but a set of initializersnitc :: MMethod :: is_root_init=
The constructor is a (the) root init with empty signature but a set of initializerscore :: Object :: is_same_instance
Return true ifself
and other
are the same instance (i.e. same identity).
core :: Object :: is_same_serialized
Isself
the same as other
in a serialization context?
core :: Object :: is_same_type
Return true ifself
and other
have the same dynamic type.
nitc :: MMethod :: is_toplevel
Is the property defined at the top_level of the module?nitc :: MMethod :: is_toplevel=
Is the property defined at the top_level of the module?nitc :: MEntity :: json_namespace
Returnself.full_name
as an object that can be serialized to json.
nitc :: MEntity :: line_separator
nitc :: MEntity :: linkto_text
Link to theself
with a specific text.
nitc :: MProperty :: lookup_all_definitions
Return all definitions in a linearization ordernitc :: MProperty :: lookup_definitions
Return the most specific property definitions defined or inherited by a type.nitc :: MProperty :: lookup_first_definition
Return the most specific definition in the linearization ofmtype
.
nitc :: MProperty :: lookup_super_definitions
Return the most specific property definitions inherited by a type.nitc :: MContract :: make_contract
Build a new contract method with a specific blockn_block
in a specified mclassdef
nitc :: MMethod :: mcontract_facet
The contract facet of the methodnitc :: MMethod :: mcontract_facet=
The contract facet of the methodnitc :: MEntity :: mdoc_or_fallback
The documentation associated to the entity or their main nested entity.nitc :: MProperty :: mpropdefs=
All definitions of the property.serialization :: Serializable :: msgpack_extra_array_items
Hook to request a larger than usual metadata arraycore :: Object :: native_class_name
The class name of the object in CString format.nitc :: MContract :: no_intro_contract
Method use to diplay warning when the contract is not present at the introductioncore :: Object :: output_class_name
Display class name on stdout (debug only).mentity
nitc :: MEntity :: ratings_by_dimension
Get the ratings of adimension
nitc :: MMethod :: restful_async
Is this arestful
method to be executed asynchronously
nitc :: MMethod :: restful_async=
Is this arestful
method to be executed asynchronously
nitc :: MMethod :: restful_resources
Associated resources within an action, e.g.foo
in http://localhost/foo?arg=bar
nitc :: MMethod :: restful_resources=
Associated resources within an action, e.g.foo
in http://localhost/foo?arg=bar
nitc :: MMethod :: restful_verbs
HTTP access methods, e.g.GET
nitc :: MMethod :: restful_verbs=
HTTP access methods, e.g.GET
nitc :: MProperty :: select_most_specific
Return an array containing olny the most specific property definitionsserialization :: Serializable :: serialize_msgpack
Serializeself
to MessagePack bytes
serialization :: Serializable :: serialize_to
Serializeself
to serializer
serialization :: Serializable :: serialize_to_json
Serializeself
to JSON
serialization :: Serializable :: serialize_to_or_delay
Accept references or force direct serialization (usingserialize_to
)
nitc :: MMethod :: setter_for=
The attribute this setter is fornitc :: MMethod :: short_cname
Short name of this method in C (without the class name)nitc :: MEntity :: source_url
Render a HTML link for the MEntity locationserialization :: Serializable :: to_pretty_json
Serializeself
to plain pretty JSON
nitc :: MEntity :: tpl_module
Builds a dot UML package diagram entity fromself
nitc :: MProperty :: visibility=
The visibility of the propertyv.enter_visit
on all nested entities.
nitc :: MEntity :: write_extra_doc
Extra auto documentation to append to thestream
nitc :: MEntity :: write_location
Location (file and line when available) of related declarationsnitc :: MProperty :: write_synopsis
Serializer::serialize
table_send
invariant
and ensure
).
# A ensure (postcondition) representation
class MEnsure
super BottomMContract
redef fun is_already_applied(mfacet: MFacet): Bool do return mfacet.has_applied_ensure
end
src/model/model_contract.nit:41,1--46,3
redef class MEnsure
redef fun adapt_specific_msignature(m_signature: MSignature): MSignature
do
return m_signature.adapt_to_ensurecondition
end
redef fun adapt_specific_nsignature(n_signature: ASignature): ASignature
do
return n_signature.adapt_to_ensurecondition
end
redef fun adapt_method_to_contract(v: ContractsVisitor, mfacet: MFacet, n_mpropdef: AMethPropdef)
do
var callsite = v.ast_builder.create_callsite(v.toolcontext.modelbuilder, n_mpropdef, self, true)
var n_self = new ASelfExpr
# argument to call the contract method
var args = n_mpropdef.n_signature.make_parameter_read(v.ast_builder)
var actual_block = n_mpropdef.n_block
# never happen. If it's the case the problem is in the contract facet building
assert actual_block isa ABlockExpr
var ret_type = n_mpropdef.mpropdef.mproperty.intro.msignature.return_mtype
if ret_type != null then
# Inject the variable result
var result_var = inject_result(v, n_mpropdef, ret_type)
# Expr to read the result variable
var read_result = v.ast_builder.make_var_read(result_var, ret_type)
var return_expr = actual_block.n_expr.pop
# Adding the read return to argument
args.add(read_result)
var n_call_contract = v.ast_builder.make_call(n_self, callsite, args)
actual_block.add_all([v.encapsulated_contract_call(n_mpropdef, [n_call_contract]), return_expr])
else
# build the call to the contract method
var n_call_contract = v.ast_builder.make_call(n_self, callsite, args)
actual_block.add v.encapsulated_contract_call(n_mpropdef, [n_call_contract])
end
n_mpropdef.do_all(v.toolcontext)
mfacet.has_applied_ensure = true
end
end
src/contracts.nit:509,1--551,3