From 6cd500f3d773b74aa72b2381531dfc9b3852f813 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Alexis=20Laferri=C3=A8re?= Date: Thu, 8 Sep 2016 13:31:15 -0400 Subject: [PATCH] src: complete some missing doc MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Alexis Laferrière --- src/compiler/abstract_compiler.nit | 28 ++++++++++++++++++++++------ src/model/model_views.nit | 2 +- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/src/compiler/abstract_compiler.nit b/src/compiler/abstract_compiler.nit index f310fe2..81c640c 100644 --- a/src/compiler/abstract_compiler.nit +++ b/src/compiler/abstract_compiler.nit @@ -1149,25 +1149,41 @@ extern void nitni_global_ref_decr( struct nitni_ref *ref ) { fun finalize_ffi_for_module(mmodule: MModule) do mmodule.finalize_ffi(self) end -# A file unit (may be more than one file if -# A file unit aim to be autonomous and is made or one or more `CodeWriter`s +# C code file generated from the `writers` and the `required_declarations` +# +# A file unit aims to be autonomous and is made or one or more `CodeWriter`s. class CodeFile + # Basename of the file, will be appended by `.h` and `.c` var name: String + + # `CodeWriter` used in sequence to fill the top of the body, then the bottom var writers = new Array[CodeWriter] + + # Required declarations keys + # + # See: `provide_declaration` var required_declarations = new HashSet[String] end -# Where to store generated lines +# Store generated lines +# +# Instances are added to `file.writers` at construction. class CodeWriter + # Parent `CodeFile` var file: CodeFile + + # Main lines of code (written at the bottom of the body) var lines = new Array[String] + + # Lines of code for declarations (written at the top of the body) var decl_lines = new Array[String] - # Add a line in the main part of the generated C + # Add a line in the main lines of code (to `lines`) fun add(s: String) do self.lines.add(s) - # Add a line in the - # (used for local or global declaration) + # Add a declaration line (to `decl_lines`) + # + # Used for local and global declaration. fun add_decl(s: String) do self.decl_lines.add(s) init diff --git a/src/model/model_views.nit b/src/model/model_views.nit index 2eec952..2f0eed5 100644 --- a/src/model/model_views.nit +++ b/src/model/model_views.nit @@ -148,7 +148,7 @@ class ModelView return model.mmodule_importation_hierarchy.sub(mmodules) end - # Build the POSet of `mmodules` hierarchy. + # Build the POSet of `mclasses` hierarchy. fun mclasses_poset(mainmodule: MModule, mclasses: Set[MClass]): POSet[MClass] do return mainmodule.flatten_mclass_hierarchy.sub(mclasses) end -- 1.7.9.5