src: update most tools to new constructors
authorJean Privat <jean@pryen.org>
Wed, 5 Nov 2014 19:52:53 +0000 (14:52 -0500)
committerJean Privat <jean@pryen.org>
Wed, 5 Nov 2014 19:52:53 +0000 (14:52 -0500)
Signed-off-by: Jean Privat <jean@pryen.org>

42 files changed:
src/c_tools.nit
src/compiler/abstract_compiler.nit
src/compiler/coloring.nit
src/compiler/global_compiler.nit
src/compiler/separate_compiler.nit
src/compiler/separate_erasure_compiler.nit
src/doc/doc_pages.nit
src/doc/doc_templates.nit
src/ffi/c.nit
src/ffi/c_compiler_options.nit
src/ffi/cpp.nit
src/ffi/ffi_base.nit
src/ffi/java.nit
src/frontend/cached.nit
src/frontend/div_by_zero.nit
src/frontend/serialization_phase.nit
src/frontend/simple_misc_analysis.nit
src/interpreter/debugger.nit
src/interpreter/naive_interpreter.nit
src/literal.nit
src/location.nit
src/model/mmodule.nit
src/model/model.nit
src/model/model_base.nit
src/model/model_viz.nit
src/model/mproject.nit
src/modelbuilder.nit
src/nitni/nitni_utilities.nit
src/nitx.nit
src/parser/lexer_work.nit
src/parser/parser_nodes.nit
src/parser/parser_work.nit
src/parser_util.nit
src/phase.nit
src/rapid_type_analysis.nit
src/semantize/flow.nit
src/semantize/local_var_init.nit
src/semantize/scope.nit
src/semantize/typing.nit
src/testing/testing_doc.nit
src/toolcontext.nit
src/transform.nit

index 07934dd..e265a2e 100644 (file)
@@ -121,13 +121,6 @@ end
 class ExternCFile
        super ExternFile
 
-       init (filename, cflags: String)
-       do
-               super filename
-
-               self.cflags = cflags
-       end
-
        # Additionnal specific CC compiler -c flags
        var cflags: String
 
index 008e8f1..62c0987 100644 (file)
@@ -465,7 +465,7 @@ abstract class AbstractCompiler
        var mainmodule: MModule is writable
 
        # The real main module of the program
-       var realmainmodule: MModule
+       var realmainmodule: MModule is noinit
 
        # The modelbuilder used to know the model and the AST
        var modelbuilder: ModelBuilder is protected writable
@@ -473,11 +473,9 @@ abstract class AbstractCompiler
        # Is hardening asked? (see --hardening)
        fun hardening: Bool do return self.modelbuilder.toolcontext.opt_hardening.value
 
-       init(mainmodule: MModule, modelbuilder: ModelBuilder)
+       init
        do
-               self.mainmodule = mainmodule
                self.realmainmodule = mainmodule
-               self.modelbuilder = modelbuilder
        end
 
        # Force the creation of a new file
@@ -504,7 +502,7 @@ abstract class AbstractCompiler
        fun new_visitor: VISITOR is abstract
 
        # Where global declaration are stored (the main .h)
-       var header: CodeWriter is writable
+       var header: CodeWriter is writable, noinit
 
        # Provide a declaration that can be requested (before or latter) by a visitor
        fun provide_declaration(key: String, s: String)
@@ -1026,9 +1024,8 @@ class CodeWriter
        # (used for local or global declaration)
        fun add_decl(s: String) do self.decl_lines.add(s)
 
-       init(file: CodeFile)
+       init
        do
-               self.file = file
                file.writers.add(self)
        end
 end
@@ -1045,7 +1042,7 @@ abstract class AbstractCompilerVisitor
        var current_node: nullable ANode = null is writable
 
        # The current `Frame`
-       var frame: nullable Frame is writable
+       var frame: nullable Frame = null is writable
 
        # Alias for self.compiler.mainmodule.object_type
        fun object_type: MClassType do return self.compiler.mainmodule.object_type
@@ -1053,11 +1050,10 @@ abstract class AbstractCompilerVisitor
        # Alias for self.compiler.mainmodule.bool_type
        fun bool_type: MClassType do return self.compiler.mainmodule.bool_type
 
-       var writer: CodeWriter
+       var writer: CodeWriter is noinit
 
-       init(compiler: COMPILER)
+       init
        do
-               self.compiler = compiler
                self.writer = new CodeWriter(compiler.files.last)
        end
 
@@ -1641,11 +1637,8 @@ class RuntimeVariable
        # false (usual value) means that the variable is a mcasttype or a subtype.
        var is_exact: Bool = false is writable
 
-       init(name: String, mtype: MType, mcasttype: MType)
+       init
        do
-               self.name = name
-               self.mtype = mtype
-               self.mcasttype = mcasttype
                assert not mtype.need_anchor
                assert not mcasttype.need_anchor
        end
index e447080..bf8dc30 100644 (file)
@@ -47,8 +47,7 @@ class POSetConflictGraph[E: Object]
 
        var poset: POSet[E]
 
-       init(poset: POSet[E]) do
-               self.poset = poset
+       init do
                extract_core
                extract_border
                extract_crown
@@ -331,11 +330,6 @@ class POSetBucketsColorer[H: Object, E: Object]
        private var poset: POSet[H]
        private var conflicts: Map[H, Set[H]]
 
-       init(poset: POSet[H], conflicts: Map[H, Set[H]]) do
-               self.poset = poset
-               self.conflicts = conflicts
-       end
-
        # Colorize buckets using the POSet and conflict graph
        fun colorize(buckets: Map[H, Set[E]]): Map[E, Int] do
                colors.clear
index c594451..113b549 100644 (file)
@@ -114,12 +114,10 @@ class GlobalCompiler
        # The result of the RTA (used to know live types and methods)
        var runtime_type_analysis: RapidTypeAnalysis
 
-       init(mainmodule: MModule, modelbuilder: ModelBuilder, runtime_type_analysis: RapidTypeAnalysis)
+       init
        do
-               super(mainmodule, modelbuilder)
                var file = new_file("{mainmodule.name}.nitgg")
                self.header = new CodeWriter(file)
-               self.runtime_type_analysis = runtime_type_analysis
                self.live_primitive_types = new Array[MClassType]
                for t in runtime_type_analysis.live_types do
                        if t.ctype != "val*" or t.mclass.name == "Pointer" then
@@ -163,7 +161,7 @@ class GlobalCompiler
 
        # Subset of runtime_type_analysis.live_types that contains only primitive types
        # Used to implement the equal test
-       var live_primitive_types: Array[MClassType]
+       var live_primitive_types: Array[MClassType] is noinit
 
        # Add a new todo task
        fun todo(m: AbstractRuntimeFunction)
@@ -916,12 +914,6 @@ private class CustomizedRuntimeFunction
        # (usually is a live type but no strong guarantee)
        var recv: MClassType
 
-       init(mmethoddef: MMethodDef, recv: MClassType)
-       do
-               super(mmethoddef)
-               self.recv = recv
-       end
-
        redef fun build_c_name
        do
                var res = self.c_name_cache
index 216ccd5..7509e55 100644 (file)
@@ -156,17 +156,15 @@ class SeparateCompiler
        private var undead_types: Set[MType] = new HashSet[MType]
        private var live_unresolved_types: Map[MClassDef, Set[MType]] = new HashMap[MClassDef, HashSet[MType]]
 
-       private var type_ids: Map[MType, Int]
-       private var type_colors: Map[MType, Int]
-       private var opentype_colors: Map[MType, Int]
-       protected var method_colors: Map[PropertyLayoutElement, Int]
-       protected var attr_colors: Map[MAttribute, Int]
-
-       init(mainmodule: MModule, mmbuilder: ModelBuilder, runtime_type_analysis: nullable RapidTypeAnalysis) do
-               super(mainmodule, mmbuilder)
+       private var type_ids: Map[MType, Int] is noinit
+       private var type_colors: Map[MType, Int] is noinit
+       private var opentype_colors: Map[MType, Int] is noinit
+       protected var method_colors: Map[PropertyLayoutElement, Int] is noinit
+       protected var attr_colors: Map[MAttribute, Int] is noinit
+
+       init do
                var file = new_file("nit.common")
                self.header = new CodeWriter(file)
-               self.runtime_type_analysis = runtime_type_analysis
                self.compile_box_kinds
        end
 
index 55844f6..b90a8bd 100644 (file)
@@ -101,12 +101,11 @@ end
 class SeparateErasureCompiler
        super SeparateCompiler
 
-       private var class_ids: Map[MClass, Int]
-       private var class_colors: Map[MClass, Int]
-       protected var vt_colors: Map[MVirtualTypeProp, Int]
+       private var class_ids: Map[MClass, Int] is noinit
+       private var class_colors: Map[MClass, Int] is noinit
+       protected var vt_colors: Map[MVirtualTypeProp, Int] is noinit
 
-       init(mainmodule: MModule, mmbuilder: ModelBuilder, runtime_type_analysis: nullable RapidTypeAnalysis) do
-               super
+       init do
 
                # Class coloring
                var poset = mainmodule.flatten_mclass_hierarchy
@@ -438,8 +437,8 @@ class SeparateErasureCompiler
 
        # Stats
 
-       private var class_tables: Map[MClass, Array[nullable MClass]]
-       private var vt_tables: Map[MClass, Array[nullable MPropDef]]
+       private var class_tables: Map[MClass, Array[nullable MClass]] is noinit
+       private var vt_tables: Map[MClass, Array[nullable MPropDef]] is noinit
 
        redef fun display_sizes
        do
index 73ae262..844e79e 100644 (file)
@@ -86,15 +86,9 @@ end
 
 # The Nitdoc class explores the model and generate pages for each mentities found
 class Nitdoc
+       var ctx: ToolContext
        var model: Model
        var mainmodule: MModule
-       var ctx: ToolContext
-
-       init(ctx: ToolContext, model: Model, mainmodule: MModule) do
-               self.ctx = ctx
-               self.model = model
-               self.mainmodule = mainmodule
-       end
 
        fun generate do
                init_output_dir
@@ -196,7 +190,10 @@ class QuickSearch
        private var mclasses = new HashSet[MClass]
        private var mpropdefs = new HashMap[String, Set[MPropDef]]
 
-       init(ctx: ToolContext, model: Model) do
+       var ctx: ToolContext
+       var model: Model
+
+       init do
                for mmodule in model.mmodules do
                        if mmodule.is_fictive then continue
                        mmodules.add mmodule
@@ -253,12 +250,6 @@ abstract class NitdocPage
        private var mainmodule: MModule
        private var name_sorter = new MEntityNameSorter
 
-       init(ctx: ToolContext, model: Model, mainmodule: MModule) do
-               self.ctx = ctx
-               self.model = model
-               self.mainmodule = mainmodule
-       end
-
        # Render the page as a html template
        fun render: Template do
                var shareurl = "."
@@ -673,13 +664,11 @@ class NitdocGroup
 
        private var mgroup: MGroup
 
-       private var concerns: ConcernsTree
-       private var intros: Set[MClass]
-       private var redefs: Set[MClass]
+       private var concerns: ConcernsTree is noinit
+       private var intros: Set[MClass] is noinit
+       private var redefs: Set[MClass] is noinit
 
-       init(ctx: ToolContext, model: Model, mainmodule: MModule, mgroup: MGroup) do
-               super
-               self.mgroup = mgroup
+       init do
                self.concerns = model.concerns_tree(mgroup.collect_mmodules)
                self.concerns.sort_with(new MConcernRankSorter)
                self.intros = mgroup.in_nesting_intro_mclasses(ctx.min_visibility)
@@ -800,14 +789,12 @@ class NitdocModule
        super NitdocPage
 
        private var mmodule: MModule
-       private var concerns: ConcernsTree
-       private var mclasses2mdefs: Map[MClass, Set[MClassDef]]
-       private var mmodules2mclasses: Map[MModule, Set[MClass]]
+       private var concerns: ConcernsTree is noinit
+       private var mclasses2mdefs: Map[MClass, Set[MClassDef]] is noinit
+       private var mmodules2mclasses: Map[MModule, Set[MClass]] is noinit
 
 
-       init(ctx: ToolContext, model: Model, mainmodule: MModule, mmodule: MModule) do
-               super
-               self.mmodule = mmodule
+       init do
                var mclassdefs = new HashSet[MClassDef]
                mclassdefs.add_all mmodule.intro_mclassdefs(ctx.min_visibility)
                mclassdefs.add_all mmodule.redef_mclassdefs(ctx.min_visibility)
@@ -1043,13 +1030,11 @@ class NitdocClass
        super NitdocPage
 
        private var mclass: MClass
-       private var concerns: ConcernsTree
-       private var mprops2mdefs: Map[MProperty, Set[MPropDef]]
-       private var mmodules2mprops: Map[MModule, Set[MProperty]]
+       private var concerns: ConcernsTree is noinit
+       private var mprops2mdefs: Map[MProperty, Set[MPropDef]] is noinit
+       private var mmodules2mprops: Map[MModule, Set[MProperty]] is noinit
 
-       init(ctx: ToolContext, model: Model, mainmodule: MModule, mclass: MClass) do
-               super
-               self.mclass = mclass
+       init do
                var mpropdefs = new HashSet[MPropDef]
                mpropdefs.add_all mclass.intro_mpropdefs(ctx.min_visibility)
                mpropdefs.add_all mclass.redef_mpropdefs(ctx.min_visibility)
@@ -1429,11 +1414,10 @@ class NitdocProperty
        super NitdocPage
 
        private var mproperty: MProperty
-       private var concerns: ConcernsTree
-       private var mmodules2mdefs: Map[MModule, Set[MPropDef]]
+       private var concerns: ConcernsTree is noinit
+       private var mmodules2mdefs: Map[MModule, Set[MPropDef]] is noinit
 
-       init(ctx: ToolContext, model: Model, mainmodule: MModule, mproperty: MProperty) do
-               super
+       init do
                self.mproperty = mproperty
                self.mmodules2mdefs = sort_by_mmodule(collect_mpropdefs)
                self.concerns = model.concerns_tree(mmodules2mdefs.keys)
index 516b17e..0e8f00b 100644 (file)
@@ -49,8 +49,6 @@ class TplPage
        # JS scripts to append at the end of the body
        var scripts = new Array[TplScript]
 
-       init do end
-
        # Add a section to this page
        fun add_section(section: TplSection) do
                sections.add section
@@ -162,10 +160,6 @@ class TplTopMenu
        # Used to select the active link.
        private var current_url: String
 
-       init(current_url: String) do
-               self.current_url = current_url
-       end
-
        # Add a new link to the menu.
        fun add_link(content: TplLink) do
                var is_active = content.href == current_url
@@ -272,18 +266,17 @@ class TplSideBox
        # Box HTML id
        # equals to `title.to_cmangle` by default
        # Used for collapsing
-       var id: String
+       var id: String is noinit
 
        # Content to display in the box
        # box will not be rendered if the content is null
-       var content: nullable Streamable is writable
+       var content: nullable Streamable = null is writable
 
        # Is the box opened by default
        # otherwise, the user will have to clic on the title to display the content
        var is_open = false is writable
 
-       init(title: String) do
-               self.title = title
+       init do
                self.id = title.to_cmangle
        end
 
@@ -358,8 +351,6 @@ class TplSummaryEntry
        # Will be displayed as a tree
        var children = new Array[TplSummaryElt]
 
-       init(text: Streamable) do self.text = text
-
        redef fun add_child(child) do children.add child
 
        redef fun rendering do
@@ -385,14 +376,14 @@ class TplSectionElt
        # Title to display if any
        # if both `title` and `summary_title` are null then
        # the section will not appear in the summary
-       var title: nullable Streamable is writable
+       var title: nullable Streamable = null is writable
 
        # Subtitle to display if any
-       var subtitle: nullable Streamable is writable
+       var subtitle: nullable Streamable = null is writable
 
        # Title that appear in the summary
        # if null use `title` instead
-       var summary_title: nullable String is writable
+       var summary_title: nullable String = null is writable
 
        # CSS classes to apply on the section element
        var css_classes = new Array[String]
@@ -401,9 +392,7 @@ class TplSectionElt
        var title_classes = new Array[String]
 
        # Parent article/section if any
-       var parent: nullable TplSectionElt
-
-       init(id: String) do self.id = id
+       var parent: nullable TplSectionElt = null
 
        init with_title(id: String, title: Streamable) do
                init(id)
@@ -660,12 +649,7 @@ class TplLink
        var text: Streamable is writable
 
        # Optional title
-       var title: nullable String is writable
-
-       init(href, text: String) do
-               self.href = href
-               self.text = text
-       end
+       var title: nullable String = null is writable
 
        init with_title(href, text, title: String) do
                init(href, text)
@@ -780,7 +764,7 @@ class TplTabPanel
        # The panel id.
        #
        # Used to show/hide panel.
-       var id: String
+       var id: String is noinit
 
        # The panel name.
        #
@@ -856,11 +840,6 @@ class TagAttribute
        var name: String
        var value: nullable String
 
-       init(name: String, value: nullable String) do
-               self.name = name
-               self.value = value
-       end
-
        redef fun rendering do
                var value = self.value
                if value == null then
@@ -902,12 +881,6 @@ class TplPiwikScript
        var tracker_url: String
        var site_id: String
 
-       init(tracker_url, site_id: String) do
-               super
-               self.tracker_url = tracker_url
-               self.site_id = site_id
-       end
-
        redef fun render_content do
                add "<!-- Piwik -->"
                add "var _paq = _paq || [];"
index 92697f5..48d4343 100644 (file)
@@ -80,11 +80,6 @@ class ForeignCType
        super ForeignType
 
        redef var ctype: String
-
-       init(ctype: String)
-       do
-               self.ctype = ctype
-       end
 end
 
 redef class NitniCallback
@@ -114,7 +109,7 @@ end
 class ToCCallContext
        super CallContext
 
-       private init do end
+       # TODO: private init because singleton instance (see `to_c_call_context`)
 
        redef fun name_mtype(mtype)
        do
@@ -127,7 +122,7 @@ end
 class FromCCallContext
        super CallContext
 
-       private init do end
+       # TODO: private init because singleton instance (see `from_c_call_context`)
 
        redef fun name_mtype(mtype) do return mtype.cname
 end
index 1d82c0d..af4e938 100644 (file)
@@ -166,7 +166,6 @@ class DirectCCompilerOption
        super CCompilerOption
 
        var option: String
-       init (opt: String) do option = opt
 end
 
 class ExecCCompilerOption
@@ -174,10 +173,4 @@ class ExecCCompilerOption
 
        var command: Array[String]
        var exec_node: ACallExpr
-
-       init (command: Array[String], exec_node: ACallExpr)
-       do
-               self.command = command
-               self.exec_node = exec_node
-       end
 end
index f75c100..fd2c600 100644 (file)
@@ -178,11 +178,6 @@ class ExternCppFile
        super ExternFile
 
        var mmodule: MModule
-       init(path: String, mmodule: MModule)
-       do
-               super
-               self.mmodule = mmodule
-       end
 
        redef fun makefile_rule_name do return "{filename.basename("")}.o"
        redef fun makefile_rule_content do return "$(CXX) $(CFLAGS) {mmodule.cpp_compiler_options} -c {filename.basename("")} -o {filename.basename("")}.o"
@@ -193,11 +188,6 @@ class ForeignCppType
        super ForeignType
 
        var cpp_type: String
-
-       init (cpp_type: String)
-       do
-               self.cpp_type = cpp_type
-       end
 end
 
 redef class NitniCallback
index 3b53826..e470276 100644 (file)
@@ -99,7 +99,9 @@ end
 # Visitor for a specific languages. Works kinda like a `Phase` and is executed
 # by a `Phase`.
 class FFILanguage
-       init(ffi_language_assignation_phase: FFILanguageAssignationPhase)
+       var ffi_language_assignation_phase: FFILanguageAssignationPhase
+
+       init
        do
                ffi_language_assignation_phase.languages.add(self)
        end
index 49a880b..44cf272 100644 (file)
@@ -330,7 +330,6 @@ class JavaClassTemplate
        super Template
 
        var java_class_name: String
-       init(name: String) do self.java_class_name = name
 
        var header = new Template
        var class_content = new Template
@@ -394,7 +393,6 @@ class ForeignJavaType
        super ForeignType
 
        var java_type: String
-       init (java_type: String) do self.java_type = java_type
 end
 
 redef class NitniCallback
index 9737245..4af7e46 100644 (file)
@@ -31,7 +31,7 @@ end
 private class CachedPhase
        super Phase
 
-       init(toolcontext, depends)
+       init
        do
                # FIXME The phase has to be executed just after `modelize_property_phase`
                # But there is no simple way to express this
index 5833009..4a8cfb4 100644 (file)
@@ -55,12 +55,6 @@ private class DivByZeroVisitor
        # The mmodule is the current module
        var mmodule: MModule
 
-       init(toolcontext: ToolContext, mmodule: MModule)
-       do
-               self.toolcontext = toolcontext
-               self.mmodule = mmodule
-       end
-
        redef fun visit(node)
        do
                # Recursively visit all sub-nodes
index 7f0427d..28b9127 100644 (file)
@@ -190,13 +190,6 @@ private class PreciseTypeVisitor
        var mclassdef: MClassDef
        var toolcontext: ToolContext
 
-       init(npropdef: AMethPropdef, mclassdef: MClassDef, toolcontext: ToolContext)
-       do
-               self.npropdef = npropdef
-               self.mclassdef = mclassdef
-               self.toolcontext = toolcontext
-       end
-
        redef fun visit(n) do n.accept_precise_type_visitor(self)
 end
 
index 9e3775d..c897ed9 100644 (file)
@@ -58,11 +58,6 @@ private class SimpleMiscVisitor
        do
                toolcontext.warning(node.hot_location, tag, msg)
        end
-
-       init(toolcontext: ToolContext)
-       do
-               self.toolcontext = toolcontext
-       end
 end
 
 
index 8723ed7..fc9ca2a 100644 (file)
@@ -65,7 +65,7 @@ end
 
 redef class ScopeVisitor
 
-       redef init(toolcontext)
+       redef init
        do
                super
                if toolcontext.dbg != null then
@@ -1442,16 +1442,11 @@ end
 private class TraceObject
 
        # Map of the local names bound to a frame
-       var trace_map: HashMap[Frame, String]
+       var trace_map = new HashMap[Frame, String]
+
        # Decides if breaking or printing statement when the variable is encountered
        var break_on_encounter: Bool
 
-       init(break_on_encounter: Bool)
-       do
-               trace_map = new HashMap[Frame, String]
-               self.break_on_encounter = break_on_encounter
-       end
-
        # Adds the local alias for a variable and the frame bound to it
        fun add_frame_variable(frame: Frame, variable_name: String)
        do
index e358b12..c6687c7 100644 (file)
@@ -67,13 +67,10 @@ class NaiveInterpreter
        var arguments: Array[String]
 
        # The main Sys instance
-       var mainobj: nullable Instance
+       var mainobj: nullable Instance is noinit
 
-       init(modelbuilder: ModelBuilder, mainmodule: MModule, arguments: Array[String])
+       init
        do
-               self.modelbuilder = modelbuilder
-               self.mainmodule = mainmodule
-               self.arguments = arguments
                self.true_instance = new PrimitiveInstance[Bool](mainmodule.bool_type, true)
                self.false_instance = new PrimitiveInstance[Bool](mainmodule.bool_type, false)
                self.null_instance = new MutableInstance(mainmodule.model.null_type)
@@ -211,13 +208,13 @@ class NaiveInterpreter
        end
 
        # The unique instance of the `true` value.
-       var true_instance: Instance
+       var true_instance: Instance is noinit
 
        # The unique instance of the `false` value.
-       var false_instance: Instance
+       var false_instance: Instance is noinit
 
        # The unique instance of the `null` value.
-       var null_instance: Instance
+       var null_instance: Instance is noinit
 
        # Return a new array made of `values`.
        # The dynamic type of the result is Array[elttype].
@@ -589,12 +586,6 @@ class PrimitiveInstance[E: Object]
        # The real value encapsulated
        redef var val: E
 
-       init(mtype: MType, val: E)
-       do
-               super(mtype)
-               self.val = val
-       end
-
        redef fun is_true
        do
                if val == true then return true
index ef4851b..e39409f 100644 (file)
@@ -44,11 +44,6 @@ private class LiteralVisitor
 
        var toolcontext: ToolContext
 
-       init(toolcontext: ToolContext)
-       do
-               self.toolcontext = toolcontext
-       end
-
        redef fun visit(n)
        do
                n.accept_literal(self)
index c092b28..993ce7d 100644 (file)
@@ -23,12 +23,13 @@ class SourceFile
        var filename: String
 
        # The content of the source
-       var string: String
+       var string: String is noinit
 
-       # Create a new sourcefile using a filename and a stream
-       init(filename: String, stream: IStream)
+       # The original stream used to initialize `string`
+       var stream: IStream
+
+       init
        do
-               self.filename = filename
                string = stream.read_all
                line_starts[0] = 0
        end
@@ -56,14 +57,6 @@ class Location
        var column_start: Int
        var column_end: Int
 
-       init(f: nullable SourceFile, line_s: Int, line_e: Int, column_s: Int, column_e: Int) do
-               file = f
-               line_start = line_s
-               line_end = line_e
-               column_start = column_s
-               column_end = column_e
-       end
-
        # The index in the start character in the source
        fun pstart: Int do return file.line_starts[line_start-1] + column_start-1
 
@@ -83,7 +76,7 @@ class Location
                return res
        end
 
-       private var text_cache: nullable String
+       private var text_cache: nullable String = null
 
        init with_file(f: SourceFile) do init(f,0,0,0,0)
 
index 923923a..f2c11a6 100644 (file)
@@ -88,10 +88,10 @@ class MModule
        # The view of the module in the `model.mmodule_nesting_hierarchy`
        #
        # TODO REMOVE, rely on mgroup instead
-       var in_nesting: POSetElement[MModule]
+       var in_nesting: POSetElement[MModule] is noinit
 
        # The view of the module in the `model.mmodule_importation_hierarchy`
-       var in_importation: POSetElement[MModule]
+       var in_importation: POSetElement[MModule] is noinit
 
        # The canonical name of the module
        # Example: `"project::name"`
@@ -106,15 +106,11 @@ class MModule
        end
 
        # Create a new empty module and register it to a model
-       init(model: Model, mgroup: nullable MGroup, name: String, location: Location)
+       init
        do
-               self.model = model
-               self.name = name
-               self.location = location
                model.mmodules_by_name.add_one(name, self)
                model.mmodules.add(self)
                self.in_nesting = model.mmodule_nesting_hierarchy.add_node(self)
-               self.mgroup = mgroup
                if mgroup != null then
                        mgroup.mmodules.add(self)
                        if mgroup.name == name then
index d776cec..f5582d8 100644 (file)
@@ -362,35 +362,20 @@ class MClass
 
        # The number of generic formal parameters
        # 0 if the class is not generic
-       var arity: Int
+       var arity: Int is noinit
 
        # Each generic formal parameters in order.
        # is empty if the class is not generic
        var mparameters = new Array[MParameterType]
 
-       # The kind of the class (interface, abstract class, etc.)
-       # In Nit, the kind of a class cannot evolve in refinements
-       var kind: MClassKind
-
-       # The visibility of the class
-       # In Nit, the visibility of a class cannot evolve in refinements
-       var visibility: MVisibility
-
-       init(intro_mmodule: MModule, name: String, parameter_names: nullable Array[String], kind: MClassKind, visibility: MVisibility)
+       protected fun setup_parameter_names(parameter_names: nullable Array[String]) is
+               autoinit
        do
-               self.intro_mmodule = intro_mmodule
-               self.name = name
                if parameter_names == null then
                        self.arity = 0
                else
                        self.arity = parameter_names.length
                end
-               self.kind = kind
-               self.visibility = visibility
-               intro_mmodule.intro_mclasses.add(self)
-               var model = intro_mmodule.model
-               model.mclasses_by_name.add_one(name, self)
-               model.mclasses.add(self)
 
                # Create the formal parameter types
                if arity > 0 then
@@ -409,6 +394,22 @@ class MClass
                end
        end
 
+       # The kind of the class (interface, abstract class, etc.)
+       # In Nit, the kind of a class cannot evolve in refinements
+       var kind: MClassKind
+
+       # The visibility of the class
+       # In Nit, the visibility of a class cannot evolve in refinements
+       var visibility: MVisibility
+
+       init
+       do
+               intro_mmodule.intro_mclasses.add(self)
+               var model = intro_mmodule.model
+               model.mclasses_by_name.add_one(name, self)
+               model.mclasses.add(self)
+       end
+
        redef fun model do return intro_mmodule.model
 
        # All class definitions (introduction and refinements)
@@ -421,7 +422,7 @@ class MClass
        #
        # Warning: such a definition may not exist in the early life of the object.
        # In this case, the method will abort.
-       var intro: MClassDef
+       var intro: MClassDef is noinit
 
        # Return the class `self` in the class hierarchy of the module `mmodule`.
        #
@@ -447,7 +448,7 @@ class MClass
        # To get other types based on a generic class, see `get_mtype`.
        #
        # ENSURE: `mclass_type.mclass == self`
-       var mclass_type: MClassType
+       var mclass_type: MClassType is noinit
 
        # Return a generic type based on the class
        # Is the class is not generic, then the result is `mclass_type`
@@ -490,7 +491,7 @@ class MClassDef
        var mmodule: MModule
 
        # The associated `MClass`
-       var mclass: MClass
+       var mclass: MClass is noinit
 
        # The bounded type associated to the mclassdef
        #
@@ -509,14 +510,11 @@ class MClassDef
 
        # Internal name combining the module and the class
        # Example: "mymodule#MyClass"
-       redef var to_s: String
+       redef var to_s: String is noinit
 
-       init(mmodule: MModule, bound_mtype: MClassType, location: Location)
+       init
        do
-               self.bound_mtype = bound_mtype
-               self.mmodule = mmodule
                self.mclass = bound_mtype.mclass
-               self.location = location
                mmodule.mclassdefs.add(self)
                mclass.mclassdefs.add(self)
                if mclass.intro_mmodule == mmodule then
@@ -988,10 +986,7 @@ class MClassType
 
        redef fun model do return self.mclass.intro_mmodule.model
 
-       private init(mclass: MClass)
-       do
-               self.mclass = mclass
-       end
+       # TODO: private init because strongly bounded to its mclass. see `mclass.mclass_type`
 
        # The formal arguments of the type
        # ENSURE: `result.length == self.mclass.arity`
@@ -1081,11 +1076,13 @@ end
 class MGenericType
        super MClassType
 
-       private init(mclass: MClass, arguments: Array[MType])
+       redef var arguments
+
+       # TODO: private init because strongly bounded to its mclass. see `mclass.get_mtype`
+
+       init
        do
-               super(mclass)
                assert self.mclass.arity == arguments.length
-               self.arguments = arguments
 
                self.need_anchor = false
                for t in arguments do
@@ -1100,9 +1097,9 @@ class MGenericType
 
        # Recursively print the type of the arguments within brackets.
        # Example: `"Map[String, List[Int]]"`
-       redef var to_s: String
+       redef var to_s: String is noinit
 
-       redef var need_anchor: Bool
+       redef var need_anchor: Bool is noinit
 
        redef fun resolve_for(mtype, anchor, mmodule, cleanup_virtual)
        do
@@ -1243,11 +1240,6 @@ class MVirtualType
        end
 
        redef fun to_s do return self.mproperty.to_s
-
-       init(mproperty: MProperty)
-       do
-               self.mproperty = mproperty
-       end
 end
 
 # The type associated to a formal parameter generic type of a class
@@ -1372,13 +1364,6 @@ class MParameterType
                end
                return mtype.collect_mclassdefs(mmodule).has(mclass.intro)
        end
-
-       init(mclass: MClass, rank: Int, name: String)
-       do
-               self.mclass = mclass
-               self.rank = rank
-               self.name = name
-       end
 end
 
 # A type prefixed with "nullable"
@@ -1390,13 +1375,12 @@ class MNullableType
 
        redef fun model do return self.mtype.model
 
-       init(mtype: MType)
+       init
        do
-               self.mtype = mtype
                self.to_s = "nullable {mtype}"
        end
 
-       redef var to_s: String
+       redef var to_s: String is noinit
 
        redef fun need_anchor do return mtype.need_anchor
        redef fun as_nullable do return self
@@ -1441,10 +1425,6 @@ end
 class MNullType
        super MType
        redef var model: Model
-       protected init(model: Model)
-       do
-               self.model = model
-       end
        redef fun to_s do return "null"
        redef fun as_nullable do return self
        redef fun need_anchor do return false
@@ -1492,7 +1472,7 @@ class MSignature
        end
 
        # REQUIRE: 1 <= mparameters.count p -> p.is_vararg
-       init(mparameters: Array[MParameter], return_mtype: nullable MType)
+       init
        do
                var vararg_rank = -1
                for i in [0..mparameters.length[ do
@@ -1502,15 +1482,13 @@ class MSignature
                                vararg_rank = i
                        end
                end
-               self.mparameters = mparameters
-               self.return_mtype = return_mtype
                self.vararg_rank = vararg_rank
        end
 
        # The rank of the ellipsis (`...`) for vararg (starting from 0).
        # value is -1 if there is no vararg.
        # Example: for "(a: Int, b: Bool..., c: Char)" #-> vararg_rank=1
-       var vararg_rank: Int
+       var vararg_rank: Int is noinit
 
        # The number or parameters
        fun arity: Int do return mparameters.length
@@ -1568,12 +1546,6 @@ class MParameter
        # Is the parameter a vararg?
        var is_vararg: Bool
 
-       init(name: String, mtype: MType, is_vararg: Bool) do
-               self.name = name
-               self.mtype = mtype
-               self.is_vararg = is_vararg
-       end
-
        redef fun to_s
        do
                if is_vararg then
@@ -1630,11 +1602,8 @@ abstract class MProperty
        # The visibility of the property
        var visibility: MVisibility
 
-       init(intro_mclassdef: MClassDef, name: String, visibility: MVisibility)
+       init
        do
-               self.intro_mclassdef = intro_mclassdef
-               self.name = name
-               self.visibility = visibility
                intro_mclassdef.intro_mproperties.add(self)
                var model = intro_mclassdef.mmodule.model
                model.mproperties_by_name.add_one(name, self)
@@ -1650,7 +1619,7 @@ abstract class MProperty
        #
        # Warning: such a definition may not exist in the early life of the object.
        # In this case, the method will abort.
-       var intro: MPROPDEF
+       var intro: MPROPDEF is noinit
 
        redef fun model do return intro.model
 
@@ -1819,11 +1788,6 @@ class MMethod
 
        redef type MPROPDEF: MMethodDef
 
-       init(intro_mclassdef: MClassDef, name: String, visibility: MVisibility)
-       do
-               super
-       end
-
        # Is the property defined at the top_level of the module?
        # Currently such a property are stored in `Object`
        var is_toplevel: Bool = false is writable
@@ -1854,10 +1818,6 @@ class MAttribute
 
        redef type MPROPDEF: MAttributeDef
 
-       init(intro_mclassdef: MClassDef, name: String, visibility: MVisibility)
-       do
-               super
-       end
 end
 
 # A global virtual type
@@ -1866,11 +1826,6 @@ class MVirtualTypeProp
 
        redef type MPROPDEF: MVirtualTypeDef
 
-       init(intro_mclassdef: MClassDef, name: String, visibility: MVisibility)
-       do
-               super
-       end
-
        # The formal type associated to the virtual type property
        var mvirtualtype = new MVirtualType(self)
 end
@@ -1889,20 +1844,17 @@ abstract class MPropDef
        # Self class
        type MPROPDEF: MPropDef
 
-       # The origin of the definition
-       var location: Location
-
        # The class definition where the property definition is
        var mclassdef: MClassDef
 
        # The associated global property
        var mproperty: MPROPERTY
 
-       init(mclassdef: MClassDef, mproperty: MPROPERTY, location: Location)
+       # The origin of the definition
+       var location: Location
+
+       init
        do
-               self.mclassdef = mclassdef
-               self.mproperty = mproperty
-               self.location = location
                mclassdef.mpropdefs.add(self)
                mproperty.mpropdefs.add(self)
                if mproperty.intro_mclassdef == mclassdef then
@@ -1919,7 +1871,7 @@ abstract class MPropDef
 
        # Internal name combining the module, the class and the property
        # Example: "mymodule#MyClass#mymethod"
-       redef var to_s: String
+       redef var to_s: String is noinit
 
        # Is self the definition that introduce the property?
        fun is_intro: Bool do return mproperty.intro == self
@@ -1950,11 +1902,6 @@ class MMethodDef
        redef type MPROPERTY: MMethod
        redef type MPROPDEF: MMethodDef
 
-       init(mclassdef: MClassDef, mproperty: MPROPERTY, location: Location)
-       do
-               super
-       end
-
        # The signature attached to the property definition
        var msignature: nullable MSignature = null is writable
 
@@ -1998,11 +1945,6 @@ class MAttributeDef
        redef type MPROPERTY: MAttribute
        redef type MPROPDEF: MAttributeDef
 
-       init(mclassdef: MClassDef, mproperty: MPROPERTY, location: Location)
-       do
-               super
-       end
-
        # The static type of the attribute
        var static_mtype: nullable MType = null is writable
 end
@@ -2014,11 +1956,6 @@ class MVirtualTypeDef
        redef type MPROPERTY: MVirtualTypeProp
        redef type MPROPDEF: MVirtualTypeDef
 
-       init(mclassdef: MClassDef, mproperty: MPROPERTY, location: Location)
-       do
-               super
-       end
-
        # The bound of the virtual type
        var bound: nullable MType = null is writable
 
@@ -2041,11 +1978,8 @@ class MClassKind
 
        # Is a constructor required?
        var need_init: Bool
-       private init(s: String, need_init: Bool)
-       do
-               self.to_s = s
-               self.need_init = need_init
-       end
+
+       # TODO: private init because enumeration.
 
        # Can a class of kind `self` specializes a class of kine `other`?
        fun can_specialize(other: MClassKind): Bool
index ae5553d..4ee1eb6 100644 (file)
@@ -58,11 +58,7 @@ class MVisibility
 
        private var level: Int
 
-       private init(s: String, level: Int)
-       do
-               self.to_s = s
-               self.level = level
-       end
+       # TODO: private init because enumeration.
 
        # Is self give less visibility than other
        # none < private < protected < public < intrude
index 03ca3eb..bdb8373 100644 (file)
@@ -26,8 +26,6 @@ class MProjectTree
        # The model where to look for information
        var model: Model
 
-       init(model: Model) do self.model = model
-
        redef fun display(a) do
                if a isa MGroup then
                        if a.parent == null then return "{a.mproject.name} ({a.filepath.to_s})"
index 49ce780..c23e5cb 100644 (file)
@@ -37,10 +37,8 @@ class MProject
 
        redef fun to_s do return name
 
-       init(name: String, model: Model)
+       init
        do
-               self.name = name
-               self.model = model
                model.mprojects.add(self)
                model.mproject_by_name.add_one(name, self)
        end
@@ -75,21 +73,19 @@ class MGroup
        # The group is the group tree on the project (`mproject.mgroups`)
        # nested groups (children) are smaller
        # nesting group (see `parent`) is bigger
-       var in_nesting: POSetElement[MGroup]
+       var in_nesting: POSetElement[MGroup] is noinit
 
        # Is `self` the root of its project?
        fun is_root: Bool do return mproject.root == self
 
        # The filepath (usually a directory) of the group, if any
-       var filepath: nullable String is writable
+       var filepath: nullable String = null is writable
 
-       init (name: String, mproject: MProject, parent: nullable MGroup)
+       init
        do
-               self.name = name
-               self.mproject = mproject
-               self.parent = parent
                var tree = mproject.mgroups
                self.in_nesting = tree.add_node(self)
+               var parent = self.parent
                if parent != null then
                        tree.add_edge(self, parent)
                end
index cc613f3..76a6305 100644 (file)
@@ -125,10 +125,8 @@ class ModelBuilder
 
        # Instantiate a modelbuilder for a model and a toolcontext
        # Important, the options of the toolcontext must be correctly set (parse_option already called)
-       init(model: Model, toolcontext: ToolContext)
+       init
        do
-               self.model = model
-               self.toolcontext = toolcontext
                assert toolcontext.modelbuilder_real == null
                toolcontext.modelbuilder_real = self
 
index f6a0959..631421a 100644 (file)
@@ -150,5 +150,6 @@ end
 # Length of the signature of a C function (long version hase the module name as prefix)
 class SignatureLength
        private var long: Bool
-       private init(long: Bool) do self.long = long
+
+       # TODO: private init because singleton class.
 end
index 0353560..68d9a47 100644 (file)
@@ -23,11 +23,11 @@ import modelize
 # then wait for query on std in to display documentation
 class NitIndex
        private var toolcontext: ToolContext
-       private var model: Model
-       private var mbuilder: ModelBuilder
-       private var mainmodule: MModule
-       private var arguments: Array[String]
-       private var renderer: PagerMatchesRenderer
+       private var model: Model is noinit
+       private var mbuilder: ModelBuilder is noinit
+       private var mainmodule: MModule is noinit
+       private var arguments: Array[String] is noinit
+       private var renderer: PagerMatchesRenderer is noinit
 
        # New constructor to use the pre-calculated model when interpreting a module
        init with_infos(mbuilder: ModelBuilder, mmodule: MModule) do
@@ -42,9 +42,8 @@ class NitIndex
                renderer = new PagerMatchesRenderer(self)
        end
 
-       init(toolcontext: ToolContext) do
+       init do
                # We need a model to collect stufs
-               self.toolcontext = toolcontext
                self.arguments = toolcontext.option_context.rest
 
                if arguments.length > 2 then
@@ -234,19 +233,11 @@ end
 private class IndexQuery
        var string: String
        var keyword: String
-       init(string: String, keyword: String) do
-               self.string = string
-               self.keyword = keyword
-       end
 end
 
 private class IndexQueryPair
        super IndexQuery
        var category: String
-       init(string: String, keyword: String, category: String) do
-               super(string, keyword)
-               self.category = category
-       end
 end
 
 # A match to a query in the nit index
@@ -298,7 +289,6 @@ end
 
 private class PagerMatchesRenderer
        var index: NitIndex
-       init(index: NitIndex) do self.index = index
 
        fun render_matches(query: IndexQuery, matches: Collection[IndexMatch]) do
                var pager = new Pager
index d8c287a..b933208 100644 (file)
@@ -80,8 +80,9 @@ end
 # It is better user with the Parser
 class Lexer
        super TablesCapable
+
        # Last peeked token
-       var token: nullable Token
+       var token: nullable Token = null
 
        # Lexer current state
        private var state: Int = 0
@@ -104,12 +105,6 @@ class Lexer
        # Constante state values
        private fun state_initial: Int do return 0 end
 
-       # Create a new lexer for a stream (and a name)
-       init(file: SourceFile)
-       do
-               self.file = file
-       end
-
        # The last peeked token to chain them
        private var last_token: nullable Token = null
 
index a4d6d44..a7f8071 100644 (file)
@@ -2070,10 +2070,5 @@ end
 class Start
        super Prod
        var n_base: nullable AModule is writable
-       var n_eof: EOF is writable, noinit
-       init(n_base: nullable AModule, n_eof: EOF)
-       do
-               self._n_base = n_base
-               self._n_eof = n_eof
-       end
+       var n_eof: EOF is writable
 end
index 4d67908..41d6741 100644 (file)
@@ -24,12 +24,6 @@ private class State
 
        # The node stored with the state in the stack
        var nodes: nullable Object
-
-       init(state: Int, nodes: nullable Object)
-       do
-               _state = state
-               _nodes = nodes
-       end
 end
 
 # The parser of the Nit language.
@@ -39,17 +33,13 @@ class Parser
        var lexer: Lexer
 
        # Stack of pushed states and productions
-       private var stack: Array[State]
+       private var stack = new Array[State]
 
        # Position in the stack
-       private var stack_pos: Int
+       private var stack_pos: Int = -1
 
-       # Create a new parser based on a given lexer
-       init(lexer: Lexer)
+       init
        do
-               _lexer = lexer
-               _stack = new Array[State]
-               _stack_pos = -1
                build_reduce_table
        end
 
@@ -163,7 +153,7 @@ class Parser
                end
        end
 
-       private var reduce_table: Array[ReduceAction]
+       private var reduce_table: Array[ReduceAction] is noinit
        private fun build_reduce_table is abstract
 end
 
@@ -269,5 +259,4 @@ private abstract class ReduceAction
                return l1
        end
        var goto: Int
-       init(g: Int) do _goto = g
 end
index ff97a78..82aec57 100644 (file)
@@ -269,7 +269,6 @@ end
 private class CollectTokensByTextVisitor
        super Visitor
        var text: String
-       init(text: String) do self.text = text
        var result = new Array[Token]
        redef fun visit(node)
        do
@@ -281,7 +280,6 @@ end
 private class CollectAnnotationsByNameVisitor
        super Visitor
        var name: String
-       init(name: String) do self.name = name
        var result = new Array[AAnnotation]
        redef fun visit(node)
        do
index 57b8b53..2011cd8 100644 (file)
@@ -163,13 +163,16 @@ abstract class Phase
        var toolcontext: ToolContext
 
        # The dependence relation of the phase with the other phases
-       var in_hierarchy: POSetElement[Phase]
+       var in_hierarchy: POSetElement[Phase] is noinit
+
+       # The explicit dependences, used to initialize `in_importation`
+       var depends: nullable Collection[Phase]
 
        # Initialize and register a phase to the toolcontext
-       init(toolcontext: ToolContext, depends: nullable Collection[Phase])
+       init
        do
-               self.toolcontext = toolcontext
                in_hierarchy = toolcontext.phases.add_node(self)
+               var depends = self.depends
                if depends != null then
                        for d in depends do
                                toolcontext.phases.add_edge(self, d)
index 378c31d..9f97e45 100644 (file)
@@ -441,11 +441,8 @@ class RapidTypeVisitor
        var receiver: MClassType
        var mpropdef: MPropDef
 
-       init(analysis: RapidTypeAnalysis, receiver: MClassType, mpropdef: MPropDef)
+       init
        do
-               self.analysis = analysis
-               self.receiver = receiver
-               self.mpropdef = mpropdef
                assert not receiver.need_anchor
        end
 
index 522a347..02ce863 100644 (file)
@@ -33,19 +33,17 @@ end
 private class FlowVisitor
        super Visitor
 
-       var current_flow_context: FlowContext
+       var current_flow_context = new FlowContext
 
        var toolcontext: ToolContext
 
-       init(toolcontext: ToolContext)
+       init
        do
-               self.toolcontext = toolcontext
-               current_flow_context = new FlowContext
                flows.add(current_flow_context)
                current_flow_context.is_start = true
        end
 
-       var first: nullable ANode
+       var first: nullable ANode = null
 
        redef fun visit(node)
        do
index 4889866..4b3fd52 100644 (file)
@@ -44,11 +44,6 @@ private class LocalVarInitVisitor
 
        var toolcontext: ToolContext
 
-       init(toolcontext: ToolContext)
-       do
-               self.toolcontext = toolcontext
-       end
-
        # Local variables that are possibly unset (ie local variable without an initial value)
        var maybe_unset_vars: Set[Variable] = new HashSet[Variable]
 
index 00702d0..ad6bcd8 100644 (file)
@@ -71,9 +71,8 @@ private class ScopeVisitor
 
        var selfvariable = new Variable("self")
 
-       init(toolcontext: ToolContext)
+       init
        do
-               self.toolcontext = toolcontext
                scopes.add(new Scope)
        end
 
index 1fb3e07..0d9c296 100644 (file)
@@ -39,10 +39,10 @@ private class TypeVisitor
 
        # The static type of the receiver
        # Mainly used for type tests and type resolutions
-       var anchor: nullable MClassType
+       var anchor: nullable MClassType = null
 
        # The analyzed mclassdef
-       var mclassdef: nullable MClassDef
+       var mclassdef: nullable MClassDef = null
 
        # The analyzed property
        var mpropdef: nullable MPropDef
@@ -54,10 +54,9 @@ private class TypeVisitor
        # * method called on the implicit self must be top-level
        var is_toplevel_context = false
 
-       init(modelbuilder: ModelBuilder, mmodule: MModule, mpropdef: nullable MPropDef)
+       init
        do
-               self.modelbuilder = modelbuilder
-               self.mmodule = mmodule
+               var mpropdef = self.mpropdef
 
                if mpropdef != null then
                        self.mpropdef = mpropdef
index 566e014..42d2b0c 100644 (file)
@@ -22,24 +22,15 @@ intrude import markdown
 class NitUnitExecutor
        super Doc2Mdwn
 
-       # The module to import
-       var mmodule: MModule
-
        # The prefix of the generated Nit source-file
        var prefix: String
 
+       # The module to import
+       var mmodule: MModule
+
        # The XML node associated to the module
        var testsuite: HTMLTag
 
-       # Initialize a new e
-       init(toolcontext: ToolContext, prefix: String, mmodule: MModule, testsuite: HTMLTag)
-       do
-               super(toolcontext)
-               self.prefix = prefix
-               self.mmodule = mmodule
-               self.testsuite = testsuite
-       end
-
        # All blocks of code from a same `ADoc`
        var blocks = new Array[Array[String]]
 
@@ -80,7 +71,7 @@ class NitUnitExecutor
        end
 
        # The associated node to localize warnings
-       var ndoc: nullable ADoc
+       var ndoc: nullable ADoc = null
 
        # used to generate distinct names
        var cpt = 0
index e174145..fb3aeaa 100644 (file)
@@ -448,10 +448,6 @@ class BashCompletion
 
        var toolcontext: ToolContext
 
-       init(toolcontext: ToolContext) do
-               self.toolcontext = toolcontext
-       end
-
        private fun extract_options_names: Array[String] do
                var names = new Array[String]
                for option in toolcontext.option_context.options do
index 6c8208a..2212380 100644 (file)
@@ -41,7 +41,7 @@ private class TransformPhase
        do
                var val
 
-               var v = new TransformVisitor(self, npropdef)
+               var v = new TransformVisitor(self, npropdef.mpropdef.as(not null))
                v.enter_visit(npropdef)
 
                val = new ASTValidationVisitor
@@ -53,15 +53,13 @@ private class TransformVisitor
        super Visitor
 
        var phase: TransformPhase
-       var mmodule: MModule
-       var mclassdef: MClassDef
+       var mmodule: MModule is noinit
+       var mclassdef: MClassDef is noinit
        var mpropdef: MPropDef
-       var builder: ASTBuilder
+       var builder: ASTBuilder is noinit
 
-       init(phase: TransformPhase, npropdef: APropdef)
+       init
        do
-               self.phase = phase
-               self.mpropdef = npropdef.mpropdef.as(not null)
                self.mclassdef = mpropdef.mclassdef
                self.mmodule = mclassdef.mmodule
                self.builder = new ASTBuilder(mmodule, mpropdef.mclassdef.bound_mtype)