examples: intro a README file to emscripten examples
[nit.git] / src / naive_interpreter.nit
index 510d0a0..e9d0a97 100644 (file)
@@ -572,11 +572,11 @@ redef class ANode
        private fun fatal(v: NaiveInterpreter, message: String)
        do
                if v.modelbuilder.toolcontext.opt_no_color.value == true then
-                       stderr.write("Runtime error: {message} ({location.file.filename}:{location.line_start})\n")
+                       sys.stderr.write("Runtime error: {message} ({location.file.filename}:{location.line_start})\n")
                else
-                       stderr.write("{location}: Runtime error: {message}\n{location.colored_line("0;31")}\n")
-                       stderr.write(v.stack_trace)
-                       stderr.write("\n")
+                       sys.stderr.write("{location}: Runtime error: {message}\n{location.colored_line("0;31")}\n")
+                       sys.stderr.write(v.stack_trace)
+                       sys.stderr.write("\n")
                end
                exit(1)
        end
@@ -869,11 +869,11 @@ redef class AMethPropdef
                        end
                else if cname == "NativeFile" then
                        if pname == "native_stdout" then
-                               return new PrimitiveInstance[OStream](mpropdef.mclassdef.mclass.mclass_type, stdout)
+                               return new PrimitiveInstance[OStream](mpropdef.mclassdef.mclass.mclass_type, sys.stdout)
                        else if pname == "native_stdin" then
-                               return new PrimitiveInstance[IStream](mpropdef.mclassdef.mclass.mclass_type, stdin)
+                               return new PrimitiveInstance[IStream](mpropdef.mclassdef.mclass.mclass_type, sys.stdin)
                        else if pname == "native_stderr" then
-                               return new PrimitiveInstance[OStream](mpropdef.mclassdef.mclass.mclass_type, stderr)
+                               return new PrimitiveInstance[OStream](mpropdef.mclassdef.mclass.mclass_type, sys.stderr)
                        else if pname == "io_open_read" then
                                var a1 = args[1].val.as(Buffer)
                                return new PrimitiveInstance[IStream](mpropdef.mclassdef.mclass.mclass_type, new IFStream.open(a1.to_s))
@@ -1000,11 +1000,11 @@ redef class AClassdef
        do
                var super_inits = self.super_inits
                if super_inits != null then
-                       assert args.length == 1
+                       var args_of_super = args
+                       if args.length > 1 then args_of_super = [args.first]
                        for su in super_inits do
-                               v.send(su, args)
+                               v.send(su, args_of_super)
                        end
-                       return null
                end
                var recv = args.first
                assert recv isa MutableInstance
@@ -1560,7 +1560,7 @@ redef class ASuperExpr
                if callsite != null then
                        # Add additionnals arguments for the super init call
                        if args.length == 1 then
-                               for i in [0..callsite.mproperty.intro.msignature.arity[ do
+                               for i in [0..callsite.msignature.arity[ do
                                        args.add(v.frame.arguments[i+1])
                                end
                        end