- if self.mclassdef.mpropdefs_by_property.has_key(mcontract) then
- v.toolcontext.error(n_annotation.location, "The method already has a defined `{mcontract.contract_name}` contract at line {self.mclassdef.mpropdefs_by_property[mcontract].location.line_start}")
- return true
+ var mensure = mproperty.mensure
+ var mexpect = mproperty.mexpect
+ if mensure == null and mexpect == null then
+ v.toolcontext.warning(location, "useless_nocontract", "Useless `no_contract`, no contract was declared for `{name}`. Remove the `no_contract`")
+ end
+ if mensure != null then
+ # Add an empty ensure method to replace the actual definition
+ v.toolcontext.modelbuilder.create_method_from_property(mensure, mclassdef, false, mensure.intro.msignature)
+ end
+ if mexpect != null then
+ # Add an empty expect method to replace the actual definition
+ v.toolcontext.modelbuilder.create_method_from_property(mexpect, mclassdef, false, mexpect.intro.msignature)