modelbuilder
.If the module was already parsed, the existing ASI is returned. Else the source file is loaded, and parsed and some
The importation is not done by this
REQUIRE: filepath != null
ENSURE: modelbuilder.parsed_modules.has(self)
# Force the parsing of the module using `modelbuilder`.
#
# If the module was already parsed, the existing ASI is returned.
# Else the source file is loaded, and parsed and some
#
# The importation is not done by this
#
# REQUIRE: `filepath != null`
# ENSURE: `modelbuilder.parsed_modules.has(self)`
fun parse(modelbuilder: ModelBuilder): nullable AModule
do
# Already known and loaded? then return it
var nmodule = modelbuilder.mmodule2nmodule.get_or_null(self)
if nmodule != null then return nmodule
var filepath = self.filepath
assert filepath != null
# Load it manually
nmodule = modelbuilder.load_module_ast(filepath)
if nmodule == null then return null # forward error
# build the mmodule
nmodule.mmodule = self
self.location = nmodule.location
modelbuilder.build_a_mmodule(mgroup, nmodule)
modelbuilder.parsed_modules.add self
return nmodule
end
src/loader.nit:1132,2--1160,4