Build the properties of nclassdef.

Property definitions

nitc :: modelize_property $ ModelBuilder :: build_properties
	# Build the properties of `nclassdef`.
	private fun build_properties(nclassdef: AClassdef)
	do
		# Force building recursively
		if nclassdef.build_properties_is_done then return
		nclassdef.build_properties_is_done = true
		var mclassdef = nclassdef.mclassdef
		if mclassdef == null then return # skip error
		if mclassdef.in_hierarchy == null then return # Skip error
		for superclassdef in mclassdef.in_hierarchy.direct_greaters do
			if not mclassdef2nclassdef.has_key(superclassdef) then continue
			build_properties(mclassdef2nclassdef[superclassdef])
		end

		mclassdef.build_self_type(self, nclassdef)
		for nclassdef2 in nclassdef.all_defs do
			for npropdef in nclassdef2.n_propdefs do
				npropdef.build_property(self, mclassdef)
			end
			for npropdef in nclassdef2.n_propdefs do
				npropdef.build_signature(self)
			end
			for npropdef in nclassdef2.n_propdefs do
				if not npropdef isa ATypePropdef then continue
				# Check circularity
				var mpropdef = npropdef.mpropdef
				if mpropdef == null then continue
				if mpropdef.bound == null then continue
				if not check_virtual_types_circularity(npropdef, mpropdef.mproperty, mclassdef.bound_mtype, mclassdef.mmodule) then
					# Invalidate the bound
					mpropdef.is_broken = true
					mpropdef.bound = new MErrorType(mclassdef.mmodule.model)
				end
			end
			for npropdef in nclassdef2.n_propdefs do
				# Check ATypePropdef first since they may be required for the other properties
				if not npropdef isa ATypePropdef then continue
				npropdef.check_signature(self)
			end

			for npropdef in nclassdef2.n_propdefs do
				if npropdef isa ATypePropdef then continue
				npropdef.check_signature(self)
			end
		end
		process_default_constructors(nclassdef)
	end
src/modelize/modelize_property.nit:103,2--149,4

nitc :: actors_injection_phase $ ModelBuilder :: build_properties
	redef fun build_properties(nclassdef)
	do
		if nclassdef.build_properties_is_done then return
		super

		# Get context information
		var mclass = nclassdef.mclass
		if mclass == null then return
		var mclass_def = nclassdef.mclassdef
		if mclass_def == null then return

		var actor_mclass = mclass.actor
		if actor_mclass == null then return
		var actor_mclass_def = actor_mclass.mclassdefs.first

		# Adds an `async` attribute in the worker class which is the actor class
		if mclass_def.is_intro then
			var async = new MMethod(mclass_def, "async", mclass.location, public_visibility)
			var async_def = new MMethodDef(mclass_def, async, mclass.location)
			async_def.msignature = new MSignature(new Array[MParameter], actor_mclass.mclass_type)
			async_def.is_abstract = true
		end

		# For each introduced property
		for method in mclass_def.mpropdefs do
			if not method isa MMethodDef then continue
			if not method.is_intro then continue
			if method.name == "async" then continue

			# Create a proxied method
			var actor_method = new MMethod(actor_mclass_def, method.name, actor_mclass.location, method.mproperty.visibility)
			var actor_method_def = new MMethodDef(actor_mclass_def, actor_method, actor_mclass.location)

			# Get the signature of the method ( replacing the return value with a Future if there is one)
			var signature = method.msignature
			if signature != null then
				var parameters = signature.mparameters
				var s_return_type = signature.return_mtype
				if s_return_type != null then
					var future_mclasses = mclass_def.model.get_mclasses_by_name("Future")
					assert future_mclasses != null
					var future_mclass = future_mclasses.first
					var return_type = future_mclass.get_mtype([s_return_type])
					actor_method_def.msignature = new MSignature(parameters, return_type)
				else
					actor_method_def.msignature = new MSignature(parameters, null)
				end
			end
			actor_method_def.is_abstract = true
		end
	end
src/frontend/actors_injection_phase.nit:58,2--108,4