nitlanguage
/
nit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
lib/config: fix doc
[nit.git]
/
src
/
test_test_phase.nit
diff --git
a/src/test_test_phase.nit
b/src/test_test_phase.nit
index
fc0aac1
..
cd300d4
100644
(file)
--- a/
src/test_test_phase.nit
+++ b/
src/test_test_phase.nit
@@
-14,14
+14,14
@@
# Example of simple module that aims to do some specific work on nit programs.
#
# Example of simple module that aims to do some specific work on nit programs.
#
-# Fast prototypes can just start with this skeletton.
+# Fast prototypes can just start with this skeleton.
module test_test_phase
module test_test_phase
-# We need the framework that perfoms standard code for the main-program
+# We need the framework that performs standard code for the main-program
import test_phase
# We usualy need specific phases
import test_phase
# We usualy need specific phases
-# NOTE: `frontend` is sufficent in most case (it is often too much)
+# NOTE: `frontend` is sufficient in most case (it is often too much)
import frontend
# The body of the specific work.
import frontend
# The body of the specific work.
@@
-31,17
+31,26
@@
redef fun do_work(mainmodule, given_mmodules, modelbuilder)
do
print "It works"
var model = modelbuilder.model
do
print "It works"
var model = modelbuilder.model
+ print "I have {model.mpackages.length} packages"
print "I have {model.mmodules.length} modules"
var mclasses = mainmodule.flatten_mclass_hierarchy
print "I have {model.mmodules.length} modules"
var mclasses = mainmodule.flatten_mclass_hierarchy
- print "I have also {mclasses.length} classes"
+ print "I have {mclasses.length} classes"
- var meth_cpt = 0
+ var m_cpt = 0
+ var md_cpt = 0
+ var cd_cpt = 0
for m in mainmodule.in_importation.greaters do
for cd in m.mclassdefs do
for m in mainmodule.in_importation.greaters do
for cd in m.mclassdefs do
+ cd_cpt += 1
for pd in cd.mpropdefs do
for pd in cd.mpropdefs do
- if pd isa MMethodDef then meth_cpt += 1
+ if pd isa MMethodDef then
+ md_cpt += 1
+ if pd.is_intro then m_cpt += 1
+ end
end
end
end
end
end
end
- print "And {meth_cpt} definitions of methods"
+ print "For {cd_cpt} definitions of classes"
+ print "I have {m_cpt} methods"
+ print "For {md_cpt} definitions of methods"
end
end