From 388a8ddc31ed4f6e1f52b4ba2e81111653e1c55d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Alexis=20Laferri=C3=A8re?= Date: Fri, 5 Jun 2015 09:48:53 -0400 Subject: [PATCH] src: intro `call_extern` in interpreter MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Alexis Laferrière --- src/interpreter/naive_interpreter.nit | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/interpreter/naive_interpreter.nit b/src/interpreter/naive_interpreter.nit index 16e0b48..b1cd48d 100644 --- a/src/interpreter/naive_interpreter.nit +++ b/src/interpreter/naive_interpreter.nit @@ -800,13 +800,21 @@ redef class AMethPropdef if mpropdef.is_intern then fatal(v, "NOT YET IMPLEMENTED intern {mpropdef}") else if mpropdef.is_extern then - fatal(v, "NOT YET IMPLEMENTED extern {mpropdef}") + var res = call_extern(v, mpropdef, arguments, f) + if res != v.error_instance then return res else fatal(v, "NOT YET IMPLEMENTED {mpropdef}") end abort end + # Call this extern method + protected fun call_extern(v: NaiveInterpreter, mpropdef: MMethodDef, arguments: Array[Instance], f: Frame): nullable Instance + do + fatal(v, "NOT YET IMPLEMENTED extern {mpropdef}") + return v.error_instance + end + # Interprets a intern or a shortcut extern method. # Returns the result for a function, `null` for a procedure, or `error_instance` if the method is unknown. private fun intern_call(v: NaiveInterpreter, mpropdef: MMethodDef, args: Array[Instance]): nullable Instance -- 1.7.9.5