Moved NitIndex redefintion from Debugger to Nitx
authorLucas Bajolet <r4pass@hotmail.com>
Thu, 14 Nov 2013 18:21:40 +0000 (13:21 -0500)
committerLucas Bajolet <r4pass@hotmail.com>
Thu, 14 Nov 2013 18:21:40 +0000 (13:21 -0500)
Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>

src/debugger.nit
src/nitx.nit

index b71edd5..ae1ac5a 100644 (file)
@@ -19,30 +19,7 @@ module debugger
 
 import breakpoint
 intrude import naive_interpreter
-intrude import nitx
-
-redef class NitIndex
-
-       # New constructor to use the pre-calculated model when interpreting a module
-       init with_infos(model: Model, mbuilder: ModelBuilder, mmodule: MModule, toolctx: ToolContext) do
-
-               self.model = model
-               self.mbuilder = mbuilder
-
-               self.mainmodule = mmodule
-               self.toolcontext = toolctx
-               self.arguments = toolctx.option_context.rest
-
-               renderer = new PagerMatchesRenderer(self)
-       end
-
-       redef fun search(s)
-       do
-               if s == ":q" then return
-               super
-       end
-
-end
+import nitx
 
 redef class ToolContext
        # -d
@@ -298,7 +275,7 @@ class Debugger
                        return step_over
                # Opens a new NitIndex prompt on current model
                else if command == "nitx" then
-                       new NitIndex.with_infos(modelbuilder.model, modelbuilder, self.mainmodule, self.modelbuilder.toolcontext).prompt
+                       new NitIndex.with_infos(modelbuilder, self.mainmodule).prompt
                        return true
                # Continues execution until the end
                else if command == "c" then
index 8915412..4b5183f 100644 (file)
@@ -30,6 +30,19 @@ class NitIndex
        private var arguments: Array[String]
        private var renderer: PagerMatchesRenderer
 
+       # New constructor to use the pre-calculated model when interpreting a module
+       init with_infos(mbuilder: ModelBuilder, mmodule: MModule) do
+
+               self.model = mbuilder.model
+               self.mbuilder = mbuilder
+
+               self.mainmodule = mmodule
+               self.toolcontext = mbuilder.toolcontext
+               self.arguments = toolcontext.option_context.rest
+
+               renderer = new PagerMatchesRenderer(self)
+       end
+
        init(toolcontext: ToolContext) do
                # We need a model to collect stufs
                self.toolcontext = toolcontext
@@ -107,7 +120,7 @@ class NitIndex
                        prompt
                        return
                end
-               if entry == ":q" then exit(0)
+               if entry == ":q" then return
 
                # Parse query string
                var query = parse_query(entry)