nit tools: fix typo and style in documentation
authorJean Privat <jean@pryen.org>
Thu, 15 Aug 2013 18:16:06 +0000 (14:16 -0400)
committerJean Privat <jean@pryen.org>
Thu, 15 Aug 2013 18:34:26 +0000 (14:34 -0400)
Signed-off-by: Jean Privat <jean@pryen.org>

16 files changed:
src/abstract_compiler.nit
src/cached.nit
src/counter.nit
src/debugger.nit
src/flow.nit
src/global_compiler.nit
src/layout_builders.nit
src/metrics/generate_hierarchies.nit
src/metrics/nullables_metrics.nit
src/metrics/static_types_metrics.nit
src/modelbuilder.nit
src/modelize_class.nit
src/modelize_property.nit
src/naive_interpreter.nit
src/scope.nit
src/typing.nit

index f508a92..53ccced 100644 (file)
@@ -441,8 +441,8 @@ abstract class AbstractCompiler
 
        # Display stats about compilation process
        # Metrics used:
-       #       * type tests against resolved types (x isa Collection[Animal])
-       #       * type tests against unresolved types (x isa Collection[E])
+       #       * type tests against resolved types (`x isa Collection[Animal]`)
+       #       * type tests against unresolved types (`x isa Collection[E]`)
        #       * type tests skipped
        #       * type tests total
        #       *
@@ -525,7 +525,7 @@ abstract class AbstractCompilerVisitor
        # The current visited AST node
        var current_node: nullable ANode writable = null
 
-       # The current Frame
+       # The current `Frame`
        var frame: nullable Frame writable
 
        # Alias for self.compiler.mainmodule.object_type
@@ -542,10 +542,10 @@ abstract class AbstractCompilerVisitor
                self.writer = new CodeWriter(compiler.files.last)
        end
 
-       # Force to get the primitive class named `name' or abort
+       # Force to get the primitive class named `name` or abort
        fun get_class(name: String): MClass do return self.compiler.mainmodule.get_primitive_class(name)
 
-       # Force to get the primitive property named `name' in the instance `recv' or abort
+       # Force to get the primitive property named `name` in the instance `recv` or abort
        fun get_property(name: String, recv: MType): MMethod
        do
                assert recv isa MClassType
@@ -561,7 +561,7 @@ abstract class AbstractCompilerVisitor
 
        fun native_array_def(pname: String, ret_type: nullable MType, arguments: Array[RuntimeVariable]) is abstract
 
-       # Transform varargs, in raw arguments, into a single argument of type Array
+       # Transform varargs, in raw arguments, into a single argument of type `Array`
        # Note: this method modify the given `args`
        # If there is no vararg, then `args` is not modified.
        fun varargize(mpropdef: MPropDef, msignature: MSignature, args: Array[RuntimeVariable])
@@ -613,8 +613,8 @@ abstract class AbstractCompilerVisitor
 
        # Unsafely cast a value to a new type
        # ie the result share the same C variable but my have a different mcasttype
-       # NOTE: if the adaptation is useless then `value' is returned as it.
-       # ENSURE: return.name == value.name
+       # NOTE: if the adaptation is useless then `value` is returned as it.
+       # ENSURE: `(return).name == value.name`
        fun autoadapt(value: RuntimeVariable, mtype: MType): RuntimeVariable
        do
                mtype = self.anchor(mtype)
@@ -655,10 +655,10 @@ abstract class AbstractCompilerVisitor
        #  Generate a static call on a method definition
        fun call(m: MMethodDef, recvtype: MClassType, args: Array[RuntimeVariable]): nullable RuntimeVariable is abstract
 
-       #  Generate a polymorphic send for the method `m' and the arguments `args'
+       #  Generate a polymorphic send for the method `m` and the arguments `args`
        fun send(m: MMethod, args: Array[RuntimeVariable]): nullable RuntimeVariable is abstract
 
-       # Generate a monomorphic send for the method `m', the type `t' and the arguments `args'
+       # Generate a monomorphic send for the method `m`, the type `t` and the arguments `args`
        fun monomorphic_send(m: MMethod, t: MType, args: Array[RuntimeVariable]): nullable RuntimeVariable
        do
                assert t isa MClassType
@@ -700,7 +700,7 @@ abstract class AbstractCompilerVisitor
        private var names: HashSet[String] = new HashSet[String]
        private var last: Int = 0
 
-       # Return a new name based on `s' and unique in the visitor
+       # Return a new name based on `s` and unique in the visitor
        fun get_name(s: String): String
        do
                if not self.names.has(s) then
@@ -734,7 +734,7 @@ abstract class AbstractCompilerVisitor
        private var escapemark_names = new HashMap[EscapeMark, String]
 
        # Return a "const char*" variable associated to the classname of the dynamic type of an object
-       # NOTE: we do not return a RuntimeVariable "NativeString" as the class may not exist in the module/program
+       # NOTE: we do not return a `RuntimeVariable` "NativeString" as the class may not exist in the module/program
        fun class_name_string(value: RuntimeVariable): String is abstract
 
        # Variables handling
@@ -849,7 +849,7 @@ abstract class AbstractCompilerVisitor
        end
 
        # look for a needed .h and .c file for a given .nit source-file
-       # FIXME: bad API, parameter should be a MModule, not its source-file
+       # FIXME: bad API, parameter should be a `MModule`, not its source-file
        fun add_extern(file: String)
        do
                file = file.strip_extension(".nit")
@@ -873,7 +873,7 @@ abstract class AbstractCompilerVisitor
                self.compiler.extern_bodies.add(f)
        end
 
-       # Return a new local runtime_variable initialized with the C expression `cexpr'.
+       # Return a new local runtime_variable initialized with the C expression `cexpr`.
        fun new_expr(cexpr: String, mtype: MType): RuntimeVariable
        do
                var res = new_var(mtype)
@@ -893,7 +893,7 @@ abstract class AbstractCompilerVisitor
                self.add("exit(1);")
        end
 
-       # Generate a return with the value `s'
+       # Generate a return with the value `s`
        fun ret(s: RuntimeVariable)
        do
                self.assign(self.frame.returnvar.as(not null), s)
@@ -934,7 +934,7 @@ abstract class AbstractCompilerVisitor
                return res
        end
 
-       # Alias for `self.expr(nexpr, self.bool_type)'
+       # Alias for `self.expr(nexpr, self.bool_type)`
        fun expr_bool(nexpr: AExpr): RuntimeVariable do return expr(nexpr, bool_type)
 
        # Safely show a debug message on the current node and repeat the message in the C code as a comment
@@ -980,7 +980,7 @@ abstract class AbstractRuntimeFunction
        # May inline the body or generate a C function call
        fun call(v: VISITOR, arguments: Array[RuntimeVariable]): nullable RuntimeVariable is abstract
 
-       # Generate the code for the RuntimeFunction
+       # Generate the code for the `AbstractRuntimeFunction`
        # Warning: compile more than once compilation makes CC unhappy
        fun compile_to_c(compiler: COMPILER) is abstract
 end
@@ -988,7 +988,7 @@ end
 # A runtime variable hold a runtime value in C.
 # Runtime variables are associated to Nit local variables and intermediate results in Nit expressions.
 #
-# The tricky point is that a single C variable can be associated to more than one RuntimeVariable because the static knowledge of the type of an expression can vary in the C code.
+# The tricky point is that a single C variable can be associated to more than one `RuntimeVariable` because the static knowledge of the type of an expression can vary in the C code.
 class RuntimeVariable
        # The name of the variable in the C code
        var name: String
@@ -1032,7 +1032,7 @@ class RuntimeVariable
        end
 end
 
-# A frame correspond to a visited property in a GlobalCompilerVisitor
+# A frame correspond to a visited property in a `GlobalCompilerVisitor`
 class Frame
 
        type VISITOR: AbstractCompilerVisitor
@@ -1784,7 +1784,7 @@ end
 
 redef class AExpr
        # Try to compile self as an expression
-       # Do not call this method directly, use `v.expr' instead
+       # Do not call this method directly, use `v.expr` instead
        private fun expr(v: AbstractCompilerVisitor): nullable RuntimeVariable
        do
                v.add("printf(\"NOT YET IMPLEMENTED {class_name}:{location.to_s}\\n\");")
@@ -1799,7 +1799,7 @@ redef class AExpr
        end
 
        # Try to compile self as a statement
-       # Do not call this method directly, use `v.stmt' instead
+       # Do not call this method directly, use `v.stmt` instead
        private fun stmt(v: AbstractCompilerVisitor)
        do
                var res = expr(v)
@@ -2405,7 +2405,7 @@ end
 # Utils
 
 redef class Array[E]
-       # Return a new Array with the elements only contened in 'self' and not in 'o'
+       # Return a new `Array` with the elements only contened in self and not in `o`
        fun -(o: Array[E]): Array[E] do
                var res = new Array[E]
                for e in self do if not o.has(e) then res.add(e)
@@ -2414,7 +2414,7 @@ redef class Array[E]
 end
 
 redef class MModule
-       # All 'mproperties' associated to all 'mclassdefs' of `mclass`
+       # All `MProperty` associated to all `MClassDef` of `mclass`
        fun properties(mclass: MClass): Set[MProperty] do
                if not self.properties_cache.has_key(mclass) then
                        var properties = new HashSet[MProperty]
index 2302d97..0567a27 100644 (file)
@@ -76,7 +76,7 @@ private class CachedPhase
                cache_mpropdef.static_mtype = mtype.as_nullable
 
                # Create another new private attribute to store the boolean «is the function cached?»
-               # The point is to manage the case where `null' is a genuine return value of the method
+               # The point is to manage the case where `null` is a genuine return value of the method
                var is_cached_mpropdef = new MAttributeDef(mclassdef, new MAttribute(mclassdef, "@{name}<is_cached>", private_visibility), location)
                is_cached_mpropdef.static_mtype = mclassdef.mmodule.get_primitive_class("Bool").mclass_type
                # FIXME? Because there is a default value ("false") a real propdef is required
@@ -109,15 +109,15 @@ private class CachedPhase
                proxy_body.collect_tokens_by_text("_cache_write").first.text = cache_mpropdef.mproperty.name
                proxy_body.collect_tokens_by_text("call_real").first.text = real_mpropdef.mproperty.name
 
-               # FIXME a last transformation cannot be done yet. So, the call to `super` (ASuperExpr) is broken in cached methods.
+               # FIXME a last transformation cannot be done yet. So, the call to `super` (`ASuperExpr`) is broken in cached methods.
 
                # Give the original body to the private real methoddef
                real_npropdef.n_block.replace_with(real_body)
        end
 
        # Detach `n` from its original AST and attach it to `m` (and its related AST)
-       # `n' must not be already attached to an existing model entity
-       # `m' must not be already attached to an existing AST node
+       # `n` must not be already attached to an existing model entity
+       # `m` must not be already attached to an existing AST node
        fun associate_propdef(m: MPropDef, n: APropdef)
        do
                # FIXME: the model-AST relations **must** be rationalized:
index 6db5c2b..2812f93 100644 (file)
@@ -18,7 +18,7 @@ module counter
 import poset
 
 # A counter counts occurrences of things
-# Use this instead of a HashMap[E, Int]
+# Use this instead of a `HashMap[E, Int]`
 class Counter[E: Object]
        super Map[E, Int]
 
@@ -27,7 +27,7 @@ class Counter[E: Object]
 
        private var map = new HashMap[E, Int]
 
-       # The number of counted occurrences of `e'
+       # The number of counted occurrences of `e`
        redef fun [](e: E): Int
        do
                var map = self.map
@@ -46,7 +46,7 @@ class Counter[E: Object]
 
        redef fun values do return map.values
 
-       # Count one more occurrence of `e'
+       # Count one more occurrence of `e`
        fun inc(e: E)
        do
                self.map[e] = self[e] + 1
@@ -104,7 +104,6 @@ class Counter[E: Object]
        # Use `element_to_s` to display the element
        fun print_elements(count: Int)
        do
-               # Display most used types (ie the last of `types')
                print " list:"
                var list = self.sort
                var min = count
@@ -170,7 +169,7 @@ redef class POSet[E]
        end
 end
 
-# Helper function to display n/d and handle division by 0
+# Helper function to display `n/d` and handle division by 0
 fun div(n: Int, d: Int): String
 do
        if d == 0 then return "na"
index 8e17340..e33a3b0 100644 (file)
@@ -35,8 +35,8 @@ redef class ToolContext
 end
 
 redef class ModelBuilder
-       # Execute the program from the entry point (Sys::main) of the `mainmodule'
-       # `arguments' are the command-line arguments in order
+       # Execute the program from the entry point (Sys::main) of the `mainmodule`
+       # `arguments` are the command-line arguments in order
        # REQUIRE that:
        #   1. the AST is fully loaded.
        #   2. the model is fully built.
@@ -69,7 +69,7 @@ redef class ModelBuilder
        end
 end
 
-# The class extending NaiveInterpreter by adding debugging methods
+# The class extending `NaiveInterpreter` by adding debugging methods
 class Debugger
        super NaiveInterpreter
 
index 3f91b93..05a40b9 100644 (file)
@@ -187,13 +187,13 @@ private class FlowVisitor
 end
 
 # A Node in the static flow graph.
-# A same FlowContext can be shared by more than one ANode.
+# A same `FlowContext` can be shared by more than one `ANode`.
 class FlowContext
        # The reachable previous flow
        var previous: Array[FlowContext] = new Array[FlowContext]
 
        # Additional reachable flow that loop up to self.
-       # Loops apears in 'loop', 'while', 'for', closure and with 'continue'
+       # Loops apears in `loop`, `while`, `for`, closure and with `continue`
        var loops: Array[FlowContext] = new Array[FlowContext]
 
        private var is_marked_unreachable: Bool = false
index cd2eaa2..9c17518 100644 (file)
@@ -125,9 +125,9 @@ class GlobalCompiler
        protected var classids: HashMap[MClassType, String] = new HashMap[MClassType, String]
 
        # Declaration of structures the live Nit types
-       # Each live type is generated as an independent C `struct' type.
+       # Each live type is generated as an independent C `struct` type.
        # They only share a common first field `classid` used to implement the polymorphism.
-       # Usualy, all C variables that refers to a Nit object are typed on the abstract struct `val' that contains only the `classid` field.
+       # Usualy, all C variables that refers to a Nit object are typed on the abstract struct `val` that contains only the `classid` field.
        redef fun compile_header_structs do
                self.header.add_decl("typedef struct \{int classid;\} val; /* general C type representing a Nit instance. */")
        end
index 201ebc1..0cbd062 100644 (file)
 
 # Table layout builders
 # Tables are used to implement objects mecanisms like:
-#   * message sending
-#      * attribute accessing
-#      * typing
-#      * resolution (for generic types)
+#  * message sending
+#  * attribute accessing
+#  * typing
+#  * resolution (for generic types)
 # This module provides various layout for object tables:
-#      * coloring
-#      * binary matrix
-#      * perfect hashing (and & mod operators)
+#  * coloring
+#  * binary matrix
+#  * perfect hashing (and & mod operators)
 module layout_builders
 
 import abstract_compiler
index 4f172f4..9765a2e 100644 (file)
@@ -64,7 +64,7 @@ do
        f.close
 end
 
-# Helper function for `generate_module_hierarchy'.
+# Helper function for `generate_module_hierarchy`.
 # Create graphviz nodes for the module and recusrively for its nested modules
 private fun generate_module_hierarchy_for(mmodule: MModule, buf: Buffer)
 do
index 70b709f..ec647ea 100644 (file)
@@ -44,7 +44,7 @@ private class NullableSends
        var nullable_sends: Int = 0
        var buggy_sends: Int = 0
 
-       # Get a new visitor on a classef to add type count in `typecount'.
+       # Get a new visitor on a classef to add type count in `typecount`.
        init(modelbuilder: ModelBuilder, nclassdef: AClassdef)
        do
                self.modelbuilder = modelbuilder
index 0bc5268..f467e98 100644 (file)
@@ -43,7 +43,7 @@ private class ATypeCounterVisitor
 
        var typecount: Counter[MType]
 
-       # Get a new visitor on a classef to add type count in `typecount'.
+       # Get a new visitor on a classef to add type count in `typecount`.
        init(modelbuilder: ModelBuilder, nclassdef: AClassdef, typecount: Counter[MType])
        do
                self.modelbuilder = modelbuilder
index 8186969..1537c11 100644 (file)
@@ -107,7 +107,7 @@ class ModelBuilder
        end
 
        # Load a bunch of modules.
-       # `modules' can contains filenames or module names.
+       # `modules` can contains filenames or module names.
        # Imported modules are automatically loaded and modelized.
        # The result is the corresponding model elements.
        # Errors and warnings are printed with the toolcontext.
@@ -137,10 +137,10 @@ class ModelBuilder
                return mmodules
        end
 
-       # Return a class named `name' visible by the module `mmodule'.
+       # Return a class named `name` visible by the module `mmodule`.
        # Visibility in modules is correctly handled.
        # If no such a class exists, then null is returned.
-       # If more than one class exists, then an error on `anode' is displayed and null is returned.
+       # If more than one class exists, then an error on `anode` is displayed and null is returned.
        # FIXME: add a way to handle class name conflict
        fun try_get_mclass_by_name(anode: ANode, mmodule: MModule, name: String): nullable MClass
        do
@@ -163,11 +163,11 @@ class ModelBuilder
                return res
        end
 
-       # Return a property named `name' on the type `mtype' visible in the module `mmodule'.
+       # Return a property named `name` on the type `mtype` visible in the module `mmodule`.
        # Visibility in modules is correctly handled.
        # Protected properties are returned (it is up to the caller to check and reject protected properties).
        # If no such a property exists, then null is returned.
-       # If more than one property exists, then an error on `anode' is displayed and null is returned.
+       # If more than one property exists, then an error on `anode` is displayed and null is returned.
        # FIXME: add a way to handle property name conflict
        fun try_get_mproperty_by_name2(anode: ANode, mmodule: MModule, mtype: MType, name: String): nullable MProperty
        do
@@ -232,9 +232,9 @@ class ModelBuilder
        var paths: Array[String] = new Array[String]
 
        # Get a module by its short name; if required, the module is loaded, parsed and its hierarchies computed.
-       # If `mmodule' is set, then the module search starts from it up to the top level (see `paths');
-       # if `mmodule' is null then the module is searched in the top level only.
-       # If no module exists or there is a name conflict, then an error on `anode' is displayed and null is returned.
+       # If `mmodule` is set, then the module search starts from it up to the top level (see `paths`);
+       # if `mmodule` is null then the module is searched in the top level only.
+       # If no module exists or there is a name conflict, then an error on `anode` is displayed and null is returned.
        # FIXME: add a way to handle module name conflict
        fun get_mmodule_by_name(anode: ANode, mmodule: nullable MModule, name: String): nullable MModule
        do
@@ -433,24 +433,24 @@ class ModelBuilder
        var nmodules: Array[AModule] = new Array[AModule]
 
        # Register the nmodule associated to each mmodule
-       # FIXME: why not refine the MModule class with a nullable attribute?
+       # FIXME: why not refine the `MModule` class with a nullable attribute?
        var mmodule2nmodule: HashMap[MModule, AModule] = new HashMap[MModule, AModule]
 
        # Helper function to display an error on a node.
-       # Alias for `self.toolcontext.error(n.hot_location, text)'
+       # Alias for `self.toolcontext.error(n.hot_location, text)`
        fun error(n: ANode, text: String)
        do
                self.toolcontext.error(n.hot_location, text)
        end
 
        # Helper function to display a warning on a node.
-       # Alias for: `self.toolcontext.warning(n.hot_location, text)'
+       # Alias for: `self.toolcontext.warning(n.hot_location, text)`
        fun warning(n: ANode, text: String)
        do
                self.toolcontext.warning(n.hot_location, text)
        end
 
-       # Force to get the primitive method named `name' on the type `recv' or do a fatal error on `n'
+       # Force to get the primitive method named `name` on the type `recv` or do a fatal error on `n`
        fun force_get_primitive_method(n: ANode, name: String, recv: MClass, mmodule: MModule): MMethod
        do
                var res = mmodule.try_get_primitive_method(name, recv)
@@ -463,7 +463,7 @@ class ModelBuilder
 end
 
 redef class AModule
-       # The associated MModule once build by a `ModelBuilder'
+       # The associated MModule once build by a `ModelBuilder`
        var mmodule: nullable MModule
        # Flag that indicate if the importation is already completed
        var is_importation_done: Bool = false
index 90eb70d..14952d1 100644 (file)
@@ -33,7 +33,7 @@ private class ModelizeClassPhase
 end
 
 redef class ModelBuilder
-       # Visit the AST and create the MClass objects
+       # Visit the AST and create the `MClass` objects
        private fun build_a_mclass(nmodule: AModule, nclassdef: AClassdef)
        do
                var mmodule = nmodule.mmodule.as(not null)
@@ -96,7 +96,7 @@ redef class ModelBuilder
                nmodule.mclass2nclassdef[mclass] = nclassdef
        end
 
-       # Visit the AST and create the MClassDef objects
+       # Visit the AST and create the `MClassDef` objects
        private fun build_a_mclassdef(nmodule: AModule, nclassdef: AClassdef)
        do
                var mmodule = nmodule.mmodule.as(not null)
@@ -154,7 +154,7 @@ redef class ModelBuilder
                end
        end
 
-       # Visit the AST and set the super-types of the MClassdef objects
+       # Visit the AST and set the super-types of the `MClassDef` objects
        private fun collect_a_mclassdef_inheritance(nmodule: AModule, nclassdef: AClassdef)
        do
                var mmodule = nmodule.mmodule.as(not null)
@@ -201,8 +201,8 @@ redef class ModelBuilder
                end
        end
 
-       # Build the classes of the module `nmodule'.
-       # REQUIRE: classes of imported modules are already build. (let `phase' do the job)
+       # Build the classes of the module `nmodule`.
+       # REQUIRE: classes of imported modules are already build. (let `phase` do the job)
        private fun build_classes(nmodule: AModule)
        do
                var errcount = toolcontext.error_count
@@ -337,13 +337,13 @@ redef class ModelBuilder
        end
 
        # Register the nclassdef associated to each mclassdef
-       # FIXME: why not refine the MClassDef class with a nullable attribute?
+       # FIXME: why not refine the `MClassDef` class with a nullable attribute?
        var mclassdef2nclassdef: HashMap[MClassDef, AClassdef] = new HashMap[MClassDef, AClassdef]
 
-       # Return the static type associated to the node `ntype'.
-       # `classdef' is the context where the call is made (used to understand formal types)
-       # The mmodule used as context is `nclassdef.mmodule'
-       # In case of problem, an error is displayed on `ntype' and null is returned.
+       # Return the static type associated to the node `ntype`.
+       # `nclassdef` is the context where the call is made (used to understand formal types)
+       # The mmodule used as context is `nclassdef.mmodule`
+       # In case of problem, an error is displayed on `ntype` and null is returned.
        # FIXME: the name "resolve_mtype" is awful
        fun resolve_mtype_unchecked(nclassdef: AClassdef, ntype: AType, with_virtual: Bool): nullable MType
        do
@@ -420,10 +420,10 @@ redef class ModelBuilder
                return null
        end
 
-       # Return the static type associated to the node `ntype'.
-       # `classdef' is the context where the call is made (used to understand formal types)
-       # The mmodule used as context is `nclassdef.mmodule'
-       # In case of problem, an error is displayed on `ntype' and null is returned.
+       # Return the static type associated to the node `ntype`.
+       # `nclassdef` is the context where the call is made (used to understand formal types)
+       # The mmodule used as context is `nclassdef.mmodule`
+       # In case of problem, an error is displayed on `ntype` and null is returned.
        # FIXME: the name "resolve_mtype" is awful
        fun resolve_mtype(nclassdef: AClassdef, ntype: AType): nullable MType
        do
@@ -456,15 +456,15 @@ end
 redef class AModule
        # Flag that indicate if the class building is already completed
        var build_classes_is_done: Bool = false
-       # What is the AClassdef associated to a MClass?
+       # What is the AClassdef associated to a `MClass`?
        # Used to check multiple definition of a class.
        var mclass2nclassdef: Map[MClass, AClassdef] = new HashMap[MClass, AClassdef]
 end
 
 redef class AClassdef
-       # The associated MClass once build by a `ModelBuilder'
+       # The associated MClass once build by a `ModelBuilder`
        var mclass: nullable MClass
-       # The associated MClassDef once build by a `ModelBuilder'
+       # The associated MClassDef once build by a `ModelBuilder`
        var mclassdef: nullable MClassDef
 end
 
index 2a8a225..af15716 100644 (file)
@@ -35,10 +35,10 @@ end
 
 redef class ModelBuilder
        # Register the npropdef associated to each mpropdef
-       # FIXME: why not refine the MPropDef class with a nullable attribute?
+       # FIXME: why not refine the `MPropDef` class with a nullable attribute?
        var mpropdef2npropdef: HashMap[MPropDef, APropdef] = new HashMap[MPropDef, APropdef]
 
-       # Build the properties of `nclassdef'.
+       # Build the properties of `nclassdef`.
        # REQUIRE: all superclasses are built.
        private fun build_properties(nclassdef: AClassdef)
        do
@@ -64,7 +64,7 @@ redef class ModelBuilder
        end
 
        # Introduce or inherit default constructor
-       # This is the last part of `build_properties'.
+       # This is the last part of `build_properties`.
        private fun process_default_constructors(nclassdef: AClassdef)
        do
                var mclassdef = nclassdef.mclassdef.as(not null)
@@ -167,7 +167,7 @@ redef class AClassdef
        # The free init (implicitely constructed by the class if required)
        var mfree_init: nullable MMethodDef = null
 
-       # What is the APropdef associated to a MProperty?
+       # What is the `APropdef` associated to a `MProperty`?
        # Used to check multiple definition of a property.
        var mprop2npropdef: Map[MProperty, APropdef] = new HashMap[MProperty, APropdef]
 end
@@ -198,7 +198,7 @@ redef class APropdef
        # The associated main model entity
        type MPROPDEF: MPropDef
 
-       # The associated propdef once build by a `ModelBuilder'
+       # The associated propdef once build by a `ModelBuilder`
        var mpropdef: nullable MPROPDEF writable
 
        private fun build_property(modelbuilder: ModelBuilder, nclassdef: AClassdef) is abstract
index 07f21f8..ba80cd9 100644 (file)
@@ -34,8 +34,8 @@ redef class ToolContext
 end
 
 redef class ModelBuilder
-       # Execute the program from the entry point (Sys::main) of the `mainmodule'
-       # `arguments' are the command-line arguments in order
+       # Execute the program from the entry point (`Sys::main`) of the `mainmodule`
+       # `arguments` are the command-line arguments in order
        # REQUIRE that:
        #   1. the AST is fully loaded.
        #   2. the model is fully built.
@@ -112,11 +112,11 @@ private class NaiveInterpreter
        var returnmark: nullable Frame = null
 
        # Is a break executed?
-       # Set this mark to skip the evaluation until a labeled statement catch it with `is_break'
+       # Set this mark to skip the evaluation until a labeled statement catch it with `is_break`
        var breakmark: nullable EscapeMark = null
 
        # Is a continue executed?
-       # Set this mark to skip the evaluation until a labeled statement catch it with `is_continue'
+       # Set this mark to skip the evaluation until a labeled statement catch it with `is_continue`
        var continuemark: nullable EscapeMark = null
 
        # Is a return or a break or a continue executed?
@@ -128,8 +128,8 @@ private class NaiveInterpreter
        # Read the value when you catch a mark or reach the end of a method
        var escapevalue: nullable Instance = null
 
-       # If there is a break and is associated with `escapemark', then return true an clear the mark.
-       # If there is no break or if `escapemark' is null then return false.
+       # If there is a break and is associated with `escapemark`, then return true an clear the mark.
+       # If there is no break or if `escapemark` is null then return false.
        # Use this function to catch a potential break.
        fun is_break(escapemark: nullable EscapeMark): Bool
        do
@@ -141,8 +141,8 @@ private class NaiveInterpreter
                end
        end
 
-       # If there is a continue and is associated with `escapemark', then return true an clear the mark.
-       # If there is no continue or if `escapemark' is null then return false.
+       # If there is a continue and is associated with `escapemark`, then return true an clear the mark.
+       # If there is no continue or if `escapemark` is null then return false.
        # Use this function to catch a potential continue.
        fun is_continue(escapemark: nullable EscapeMark): Bool
        do
@@ -154,9 +154,9 @@ private class NaiveInterpreter
                end
        end
 
-       # Evaluate `n' as an expression in the current context.
+       # Evaluate `n` as an expression in the current context.
        # Return the value of the expression.
-       # If `n' cannot be evaluated, then aborts.
+       # If `n` cannot be evaluated, then aborts.
        fun expr(n: AExpr): nullable Instance
        do
                var frame = self.frame
@@ -179,9 +179,9 @@ private class NaiveInterpreter
                return i
        end
 
-       # Evaluate `n' as a statement in the current context.
-       # Do nothing if `n' is sull.
-       # If `n' cannot be evaluated, then aborts.
+       # Evaluate `n` as a statement in the current context.
+       # Do nothing if `n` is null.
+       # If `n` cannot be evaluated, then aborts.
        fun stmt(n: nullable AExpr)
        do
                if n != null then
@@ -194,46 +194,46 @@ private class NaiveInterpreter
                end
        end
 
-       # Map used to store values of nodes that must be evaluated once in the system (AOnceExpr)
+       # Map used to store values of nodes that must be evaluated once in the system (`AOnceExpr`)
        var onces: Map[ANode, Instance] = new HashMap[ANode, Instance]
 
-       # Return the boolean instance associated with `val'.
+       # Return the boolean instance associated with `val`.
        fun bool_instance(val: Bool): Instance
        do
                if val then return self.true_instance else return self.false_instance
        end
 
-       # Return the integer instance associated with `val'.
+       # Return the integer instance associated with `val`.
        fun int_instance(val: Int): Instance
        do
                var ic = self.mainmodule.get_primitive_class("Int")
                return new PrimitiveInstance[Int](ic.mclass_type, val)
        end
 
-       # Return the char instance associated with `val'.
+       # Return the char instance associated with `val`.
        fun char_instance(val: Char): Instance
        do
                var ic = self.mainmodule.get_primitive_class("Char")
                return new PrimitiveInstance[Char](ic.mclass_type, val)
        end
 
-       # Return the float instance associated with `val'.
+       # Return the float instance associated with `val`.
        fun float_instance(val: Float): Instance
        do
                var ic = self.mainmodule.get_primitive_class("Float")
                return new PrimitiveInstance[Float](ic.mclass_type, val)
        end
 
-       # The unique intance of the `true' value.
+       # The unique intance of the `true` value.
        var true_instance: Instance
 
-       # The unique intance of the `false' value.
+       # The unique intance of the `false` value.
        var false_instance: Instance
 
-       # The unique intance of the `null' value.
+       # The unique intance of the `null` value.
        var null_instance: Instance
 
-       # Return a new array made of `values'.
+       # Return a new array made of `values`.
        # The dynamic type of the result is Array[elttype].
        fun array_instance(values: Array[Instance], elttype: MType): Instance
        do
@@ -247,7 +247,7 @@ private class NaiveInterpreter
                return res
        end
 
-       # Return a new native string initialized with `txt'
+       # Return a new native string initialized with `txt`
        fun native_string_instance(txt: String): Instance
        do
                var val = new Buffer.from(txt)
@@ -298,8 +298,8 @@ private class NaiveInterpreter
        # Store known method, used to trace methods as thez are reached
        var discover_call_trace: Set[MMethodDef] = new HashSet[MMethodDef]
 
-       # Execute `mpropdef' for a `args' (where args[0] is the receiver).
-       # Return a falue if `mpropdef' is a function, or null if it is a procedure.
+       # Execute `mpropdef` for a `args` (where `args[0]` is the receiver).
+       # Return a falue if `mpropdef` is a function, or null if it is a procedure.
        # The call is direct/static. There is no message-seding/late-bindng.
        fun call(mpropdef: MMethodDef, args: Array[Instance]): nullable Instance
        do
@@ -400,8 +400,8 @@ private class NaiveInterpreter
                return null
        end
 
-       # Execute `mproperty' for a `args' (where args[0] is the receiver).
-       # Return a falue if `mproperty' is a function, or null if it is a procedure.
+       # Execute `mproperty` for a `args` (where `args[0]` is the receiver).
+       # Return a falue if `mproperty` is a function, or null if it is a procedure.
        # The call is polimotphic. There is a message-seding/late-bindng according to te receiver (args[0]).
        fun send(mproperty: MMethod, args: Array[Instance]): nullable Instance
        do
@@ -421,7 +421,7 @@ private class NaiveInterpreter
                return self.call(propdef, args)
        end
 
-       # Read the attribute `mproperty' of an instance `recv' and return its value.
+       # Read the attribute `mproperty` of an instance `recv` and return its value.
        # If the attribute in not yet initialized, then aborts with an error message.
        fun read_attribute(mproperty: MAttribute, recv: Instance): Instance
        do
@@ -457,8 +457,8 @@ private class NaiveInterpreter
 
        var collect_attr_propdef_cache = new HashMap[MType, Array[AAttrPropdef]]
 
-       # Fill the initial values of the newly created instance `recv'.
-       # `recv.mtype' is used to know what must be filled.
+       # Fill the initial values of the newly created instance `recv`.
+       # `recv.mtype` is used to know what must be filled.
        fun init_instance(recv: Instance)
        do
                for npropdef in collect_attr_propdef(recv.mtype) do
@@ -466,7 +466,7 @@ private class NaiveInterpreter
                end
        end
 
-       # Check that non nullable attributes of `recv' are correctly initialized.
+       # Check that non nullable attributes of `recv` are correctly initialized.
        # This function is used as the last instruction of a new
        fun check_init_instance(recv: Instance)
        do
@@ -497,7 +497,7 @@ abstract class Instance
        # else aborts
        fun is_true: Bool do abort
 
-       # Return true if `self' IS `o' (using the Nit semantic of is)
+       # Return true if `self` IS `o` (using the Nit semantic of is)
        fun eq_is(o: Instance): Bool do return self is o
 
        # Human readable object identity "Type#number"
@@ -595,7 +595,7 @@ end
 
 redef class ANode
        # Aborts the program with a message
-       # `v' is used to know if a colored message is displayed or not
+       # `v` is used to know if a colored message is displayed or not
        private fun fatal(v: NaiveInterpreter, message: String)
        do
                if v.modelbuilder.toolcontext.opt_no_color.value == true then
@@ -610,7 +610,7 @@ redef class ANode
 end
 
 redef class APropdef
-       # Execute a `mpropdef' associated with the current node.
+       # Execute a `mpropdef` associated with the current node.
        private fun call(v: NaiveInterpreter, mpropdef: MMethodDef, args: Array[Instance]): nullable Instance
        do
                fatal(v, "NOT YET IMPLEMENTED method kind {class_name}. {mpropdef}")
@@ -993,7 +993,7 @@ redef class AAttrPropdef
                end
        end
 
-       # Evaluate and set the default value of the attribute in `recv'
+       # Evaluate and set the default value of the attribute in `recv`
        private fun init_expr(v: NaiveInterpreter, recv: Instance)
        do
                assert recv isa MutableInstance
@@ -1025,7 +1025,7 @@ redef class ADeferredMethPropdef
 end
 
 redef class AClassdef
-       # Execute an implicit `mpropdef' associated with the current node.
+       # Execute an implicit `mpropdef` associated with the current node.
        private fun call(v: NaiveInterpreter, mpropdef: MMethodDef, args: Array[Instance]): nullable Instance
        do
                var super_inits = self.super_inits
@@ -1053,7 +1053,7 @@ end
 redef class AExpr
        # Evaluate the node as a possible expression.
        # Return a possible value
-       # NOTE: Do not call this method directly, but use `v.expr'
+       # NOTE: Do not call this method directly, but use `v.expr`
        # This method is here to be implemented by subclasses.
        private fun expr(v: NaiveInterpreter): nullable Instance
        do
@@ -1062,7 +1062,7 @@ redef class AExpr
        end
 
        # Evaluate the node as a statement.
-       # NOTE: Do not call this method directly, but use `v.stmt'
+       # NOTE: Do not call this method directly, but use `v.stmt`
        # This method is here to be implemented by subclasses (no need to return something).
        private fun stmt(v: NaiveInterpreter)
        do
index 9499312..2805556 100644 (file)
@@ -38,7 +38,7 @@ class Variable
        # The name of the variable (as used in the program)
        var name: String
 
-       # Alias of `name'
+       # Alias of `name`
        redef fun to_s do return self.name
 end
 
@@ -67,8 +67,8 @@ end
 # Visit a npropdef and:
 #  * Identify variables, closures and labels
 #  * Associate each break and continue to its escapemark
-#  * Transform ACallFormExpr that access a variable into AVarFormExpr
-#  * Transform ACallFormExpr that call a closure into AClosureCallExpr
+#  * Transform `ACallFormExpr` that access a variable into `AVarFormExpr`
+#  * Transform `ACallFormExpr` that call a closure into `AClosureCallExpr`
 # FIXME: Should the class be private?
 private class ScopeVisitor
        super Visitor
@@ -84,7 +84,7 @@ private class ScopeVisitor
                scopes.add(new Scope)
        end
 
-       # All stacked scope. `scopes.first' is the current scope
+       # All stacked scope. `scopes.first` is the current scope
        private var scopes: List[Scope] = new List[Scope]
 
        # Regiter a local variable.
@@ -101,7 +101,7 @@ private class ScopeVisitor
                return true
        end
 
-       # Look for a variable named `name'.
+       # Look for a variable named `name`.
        # Return null if no such a variable is found.
        fun search_variable(name: String): nullable Variable
        do
@@ -119,8 +119,8 @@ private class ScopeVisitor
                n.accept_scope_visitor(self)
        end
 
-       # Enter in a statement block `node' as inside a new scope.
-       # The block can be optionally attached to an `escapemark'.
+       # Enter in a statement block `node` as inside a new scope.
+       # The block can be optionally attached to an `escapemark`.
        private fun enter_visit_block(node: nullable AExpr, escapemark: nullable EscapeMark)
        do
                if node == null then return
@@ -131,7 +131,7 @@ private class ScopeVisitor
                scopes.shift
        end
 
-       # Look for a label `name'.
+       # Look for a label `name`.
        # Return nulll if no such a label is found.
        private fun search_label(name: String): nullable EscapeMark
        do
@@ -165,7 +165,7 @@ private class ScopeVisitor
 
        # Look for an escape mark optionally associated with a label.
        # If a label is given, the the escapemark of this label is returned.
-       # If there is no label, the nearest escapemark that is `for loop' ir returned.
+       # If there is no label, the nearest escapemark that is `for loop` is returned.
        # If there is no valid escapemark, then an error is displayed ans null is returned.
        # Return nulll if no such a label is found.
        private fun get_escapemark(node: ANode, nlabel: nullable ALabel): nullable EscapeMark
index 45866b7..3c11789 100644 (file)
@@ -79,7 +79,7 @@ private class TypeVisitor
                return res
        end
 
-       # Retrieve the signature of a MMethodDef resolved for a specific call.
+       # Retrieve the signature of a `MMethodDef` resolved for a specific call.
        # This method is an helper to symplify the query on the model.
        #
        # Note: `for_self` indicates if the reciever is self or not.
@@ -92,7 +92,7 @@ private class TypeVisitor
        # Check that `sub` is a subtype of `sup`.
        # If `sub` is not a valud suptype, then display an error on `node` an return null.
        # If `sub` is a safe subtype of `sup` then return `sub`.
-       # If `sun` is an insafe subtype (ie an imlicit cast is required), then return `sup`.
+       # If `sub` is an insafe subtype (ie an imlicit cast is required), then return `sup`.
        #
        # The point of the return type is to determinate the usable type on an expression:
        # If the suptype is safe, then the return type is the one on the expression typed by `sub`.
@@ -120,7 +120,7 @@ private class TypeVisitor
        # Return the type of the expression
        # Display an error and return null if:
        #  * the type cannot be determined or
-       #  * `nexpr' is a statement
+       #  * `nexpr` is a statement
        fun visit_expr(nexpr: AExpr): nullable MType
        do
                nexpr.accept_typing(self)
@@ -138,11 +138,11 @@ private class TypeVisitor
                return null
        end
 
-       # Visit an expression and expect its static type is a least a `sup'
-       # Return the type of the expression
+       # Visit an expression and expect its static type is a least a `sup`
+       # Return the type of the expression or null if
        #  * the type cannot be determined or
-       #  * `nexpr' is a statement
-       #  * `nexpt' is not a `sup'
+       #  * `nexpr` is a statement or
+       #  * `nexpr` is not a `sup`
        fun visit_expr_subtype(nexpr: AExpr, sup: nullable MType): nullable MType
        do
                var sub = visit_expr(nexpr)
@@ -157,11 +157,11 @@ private class TypeVisitor
                return res
        end
 
-       # Visit an expression and expect its static type is a bool
-       # Return the type of the expression
+       # Visit an expression and expect its static type is a `Bool`
+       # Return the type of the expression or null if
        #  * the type cannot be determined or
-       #  * `nexpr' is a statement
-       #  * `nexpt' is not a `sup'
+       #  * `nexpr` is a statement or
+       #  * `nexpr` is not a `Bool`
        fun visit_expr_bool(nexpr: AExpr): nullable MType
        do
                return self.visit_expr_subtype(nexpr, self.type_bool(nexpr))
@@ -534,10 +534,10 @@ redef class AExpr
        var mtype: nullable MType = null
 
        # Is the statement correctly typed?
-       # Used to distinguish errors and statements when `mtype' == null
+       # Used to distinguish errors and statements when `mtype == null`
        var is_typed: Bool = false
 
-       # If required, the following implicit cast ".as(XXX)"
+       # If required, the following implicit cast `.as(XXX)`
        # Such a cast may by required after evaluating the expression when
        # a unsafe operation is detected (silently accepted by the Nit language).
        # The attribute is computed by `check_subtype`
@@ -649,10 +649,10 @@ redef class AReassignFormExpr
 
        var read_type: nullable MType = null
 
-       # Determine the `reassign_property'
-       # `readtype' is the type of the reading of the left value.
-       # `writetype' is the type of the writing of the left value.
-       # (Because of ACallReassignExpr, both can be different.
+       # Determine the `reassign_property`
+       # `readtype` is the type of the reading of the left value.
+       # `writetype` is the type of the writing of the left value.
+       # (Because of `ACallReassignExpr`, both can be different.
        # Return the static type of the value to store.
        private fun resolve_reassignment(v: TypeVisitor, readtype, writetype: MType): nullable MType
        do
@@ -1105,7 +1105,7 @@ end
 
 redef class AIsaExpr
        # The static type to cast to.
-       # (different from the static type of the expression that is Bool).
+       # (different from the static type of the expression that is `Bool`).
        var cast_type: nullable MType
        redef fun accept_typing(v)
        do