# Breaks automatically when encountering an error
# Permits the injunction of commands before crashing
- redef private fun fatal(v: NaiveInterpreter, message: String)
+ redef fun fatal(v: NaiveInterpreter, message: String)
do
if v isa Debugger then
print "An error was encountered, the program will stop now."
end
# The visitor that interprets the Nit Program by walking on the AST
-private class NaiveInterpreter
+class NaiveInterpreter
# The modelbuilder that know the AST and its associations with the model
var modelbuilder: ModelBuilder
end
# Information about local variables in a running method
-private class Frame
+class Frame
# The current visited node
# The node is stored by frame to keep a stack trace
var current_node: ANode
# Arguments of the method (the first is the receiver)
var arguments: Array[Instance]
# Mapping between a variable and the current value
- var map: Map[Variable, Instance] = new HashMap[Variable, Instance]
+ private var map: Map[Variable, Instance] = new HashMap[Variable, Instance]
end
redef class ANode
# Aborts the program with a message
# `v` is used to know if a colored message is displayed or not
- private fun fatal(v: NaiveInterpreter, message: String)
+ fun fatal(v: NaiveInterpreter, message: String)
do
if v.modelbuilder.toolcontext.opt_no_color.value == true then
sys.stderr.write("Runtime error: {message} ({location.file.filename}:{location.line_start})\n")
# Implementation of the Nit virtual machine
module vm
-intrude import interpreter::naive_interpreter
+import interpreter::naive_interpreter
import model_utils
import perfect_hashing