From 63c43224a490c89e310e6f4a6f0d53ef4a24c0ae Mon Sep 17 00:00:00 2001 From: Alexandre Terrasa Date: Thu, 19 Apr 2012 15:20:06 -0400 Subject: [PATCH] Doc review on newmodel. Signed-off-by: Alexandre Terrasa --- src/modelbuilder.nit | 2 +- ...{naiveinterpreter.nit => naive_interpreter.nit} | 2 +- src/nit.nit | 2 +- src/nitstats.nit | 8 +++++++- src/runtime_type.nit | 9 ++++++--- src/scope.nit | 2 +- src/toolcontext.nit | 1 + src/typing.nit | 2 +- 8 files changed, 19 insertions(+), 9 deletions(-) rename src/{naiveinterpreter.nit => naive_interpreter.nit} (99%) diff --git a/src/modelbuilder.nit b/src/modelbuilder.nit index 752fa6a..f37a940 100644 --- a/src/modelbuilder.nit +++ b/src/modelbuilder.nit @@ -47,7 +47,7 @@ redef class ToolContext end end -# A model builder know how to load nit source files and build the associated model +# A model builder knows how to load nit source files and build the associated model # The important function is `parse_and_build' that does all the job. # The others function can be used for specific tasks class ModelBuilder diff --git a/src/naiveinterpreter.nit b/src/naive_interpreter.nit similarity index 99% rename from src/naiveinterpreter.nit rename to src/naive_interpreter.nit index cb2e61b..e06cd6f 100644 --- a/src/naiveinterpreter.nit +++ b/src/naive_interpreter.nit @@ -15,7 +15,7 @@ # limitations under the License. # Interpretation of a Nit program directly on the AST -module naiveinterpreter +module naive_interpreter import literal import typing diff --git a/src/nit.nit b/src/nit.nit index 5fbefd5..611da1a 100644 --- a/src/nit.nit +++ b/src/nit.nit @@ -19,7 +19,7 @@ module nit import modelbuilder import exprbuilder -import naiveinterpreter +import naive_interpreter # Create a tool context to handle options and paths var toolcontext = new ToolContext diff --git a/src/nitstats.nit b/src/nitstats.nit index 24bafd2..60e6631 100644 --- a/src/nitstats.nit +++ b/src/nitstats.nit @@ -14,8 +14,14 @@ # See the License for the specific language governing permissions and # limitations under the License. -# Program that collect various data about nit programs and libraries +# A program that collects various data about nit programs and libraries module nitstats +# Collected datas are : +# * number of modules +# * number of classes (interface, class, enum, extern, abstract) +# * number of class definitions and refinments +# * number of properties +# * number of used types and runtime classes import modelbuilder import exprbuilder diff --git a/src/runtime_type.nit b/src/runtime_type.nit index 2616edf..ff99f60 100644 --- a/src/runtime_type.nit +++ b/src/runtime_type.nit @@ -20,11 +20,11 @@ # Rapid type analysis is an analyse that aproximates the set of live classes # and the set of live methods starting from the entry point of the program. # These two sets are interdependant and computed together. -# It is quite efficient but the type set is global such pollute each call site. +# It is quite efficient but the type set is global and pollutes each call site. # # Heterogenous generics means that each intancied generic class is associated # to a distinct runtime type. -# Heterogenous generics has the advantage to resolve the the formal generic +# Heterogenous generics has the advantage to resolve the formal generic # parameters types but increase the number of types. # More important, heterogenous generics cannot deal with infinite number of runtime # types since the analyse tries to list them all (so some programs will be badly refused) @@ -35,7 +35,7 @@ # * `self' is monomorphic # * virtual types are all resolved # * live attributes can be determined on each class -# But the big disavantage to explode the number of runtime method: each method +# But has the disadvantage to explode the number of runtime method: each method # definition for each runtime type that need it module runtime_type @@ -82,6 +82,8 @@ redef class ModelBuilder end end +# RuntimeTypeAnalysis looks for alive runtime types in application. +# The entry point of the analysis is the mainmodule of the application. class RuntimeTypeAnalysis var modelbuilder: ModelBuilder var mainmodule: MModule @@ -152,6 +154,7 @@ class RuntimeTypeAnalysis self.live_cast_types.add(mtype) end + # Start the analysis. fun run_analysis do while not todo.is_empty do diff --git a/src/scope.nit b/src/scope.nit index 8914b31..a88496a 100644 --- a/src/scope.nit +++ b/src/scope.nit @@ -35,7 +35,7 @@ class ClosureVariable end # Mark where break and continue will branch. -# marks are either associated with a label of with a for_loop structure +# Marks are either associated with a label of with a for_loop structure class EscapeMark # The name of the label (unless the mark is an anonymous loop mark) var name: nullable String diff --git a/src/toolcontext.nit b/src/toolcontext.nit index e78ec77..5cdea5d 100644 --- a/src/toolcontext.nit +++ b/src/toolcontext.nit @@ -29,6 +29,7 @@ class Message readable var _location: nullable Location readable var _text: String + # Comparisons are made on message locations. redef fun <(other: OTHER): Bool do if location == null then return true if other.location == null then return false diff --git a/src/typing.nit b/src/typing.nit index 836a82b..e73cb9e 100644 --- a/src/typing.nit +++ b/src/typing.nit @@ -431,7 +431,7 @@ redef class AExpr # null if self is a statement of in case of error var mtype: nullable MType = null - # Is the statement correctly typed. + # Is the statement correctly typed? # Used to distinguish errors and statements when `mtype' == null var is_typed: Bool = false -- 1.7.9.5