import metrics_base
import static_types_metrics
import nullables_metrics
-import visit_self
+import self_metrics
import model_stats
import generate_hierarchies
import rta_metrics
redef class ToolContext
+ # --self
+ var opt_self = new OptionBool("Compute metrics about the usage of explicit and implicit self", "--self")
# --nullables
var opt_nullables = new OptionBool("Compute metrics on nullables send", "--nullables")
# --static-types
redef init
do
super
+ self.option_context.add_option(opt_self)
self.option_context.add_option(opt_nullables)
self.option_context.add_option(opt_static_types)
self.option_context.add_option(opt_tables)
# See the License for the specific language governing permissions and
# limitations under the License.
-# Statistics about the usage of explicit and implicit self
-module visit_self
+# Metrics about the usage of explicit and implicit self
+module self_metrics
import modelbuilder
private import metrics_base
end
end
-# Visit the AST and print statistics about the usage of self.
-fun visit_self(modelbuilder: ModelBuilder)
+# Visit the AST and print metics about the usage of self.
+fun compute_self_metrics(modelbuilder: ModelBuilder)
do
print "--- Explicit vs. Implicit Self ---"
# Visit all the source code to collect data
print ""
compute_statistics(model)
-print ""
-visit_self(modelbuilder)
+# Self usage metrics
+if toolcontext.opt_self.value then
+ print ""
+ compute_self_metrics(modelbuilder)
+end
# Nullables metrics
if toolcontext.opt_nullables.value then