The entry point of the whole typing analysis

Property definitions

nitc :: typing $ APropdef :: do_typing
	# The entry point of the whole typing analysis
	fun do_typing(modelbuilder: ModelBuilder)
	do
	end
src/semantize/typing.nit:887,2--890,4

nitc :: typing $ AAttrPropdef :: do_typing
	redef fun do_typing(modelbuilder: ModelBuilder)
	do
		if not has_value then return

		var mpropdef = self.mreadpropdef
		if mpropdef == null or mpropdef.msignature == null then return # skip error

		var v = new TypeVisitor(modelbuilder, mpropdef)
		self.selfvariable = v.selfvariable

		var nexpr = self.n_expr
		if nexpr != null then
			var mtype = self.mtype
			v.visit_expr_subtype(nexpr, mtype)
		end
		var nblock = self.n_block
		if nblock != null then
			v.visit_stmt(nblock)
			if not nblock.after_flow_context.is_unreachable then
				# We reach the end of the init without having a return, it is bad
				v.error(self, "Error: reached end of block; expected `return`.")
			end
		end
	end
src/semantize/typing.nit:962,2--985,4

nitc :: typing $ AMethPropdef :: do_typing
	redef fun do_typing(modelbuilder: ModelBuilder)
	do
		var mpropdef = self.mpropdef
		if mpropdef == null then return # skip error

		var v = new TypeVisitor(modelbuilder, mpropdef)
		self.selfvariable = v.selfvariable

		var mmethoddef = self.mpropdef.as(not null)
		var msignature = mmethoddef.msignature
		if msignature == null then return # skip error
		for i in [0..msignature.arity[ do
			var mtype = msignature.mparameters[i].mtype
			if msignature.vararg_rank == i then
				var arrayclass = v.get_mclass(self.n_signature.n_params[i], "Array")
				if arrayclass == null then return # Skip error
				mtype = arrayclass.get_mtype([mtype])
			end
			var variable = self.n_signature.n_params[i].variable
			assert variable != null
			variable.declared_type = mtype
		end

		var nblock = self.n_block
		if nblock == null then return

		loop
			v.dirty = false
			v.visit_stmt(nblock)
			if not v.has_loop or not v.dirty then break
		end

		var post_visitor = new PostTypingVisitor(v)
		post_visitor.enter_visit(self)

		if not nblock.after_flow_context.is_unreachable and msignature.return_mtype != null then
			# We reach the end of the function without having a return, it is bad
			v.error(self, "Error: reached end of function; expected `return` with a value.")
		end
	end
src/semantize/typing.nit:897,2--936,4