To protect your data, the CISO officer has suggested users to enable GitLab 2FA as soon as possible.

Commit c233bc9b authored by Tobias Pape's avatar Tobias Pape
Browse files

RPython cannot create closures dynamically

hence, we make _invoke readily availabe. Also, is_empty is now state-based
and not behavior-based
parent c46e9c2c
......@@ -19,9 +19,14 @@ class Primitive(Object, Invokable):
# Set the signature of this primitive
self._set_signature(universe.symbol_for(signature_string))
self.invoke = types.MethodType(invoke, self)
if is_empty:
self.is_empty = is_empty
self._invoke = invoke
#self.invoke = types.MethodType(invoke, self)
self._is_empty = is_empty
def invoke(self, frame, interpreter):
inv = self._invoke
inv(self, frame, interpreter)
def is_primitive(self):
return True
......@@ -49,16 +54,12 @@ class Primitive(Object, Invokable):
def is_empty(self):
# By default a primitive is not empty
return False
return self._is_empty
def empty_primitive(signature_string, universe):
# Return an empty primitive with the given signature
def _invoke(ivkbl, frame, interpreter):
# Write a warning to the screen
universe.std_println("Warning: undefined primitive " +
ivkbl.get_signature().get_string() + " called")
# The empty primitives are empty
def _is_empty(self): return True
return Primitive(signature_string, universe, _invoke, _is_empty)
return Primitive(signature_string, universe, _invoke, True)
def _invoke(ivkbl, frame, interpreter):
# Write a warning to the screen
print "Warning: undefined primitive", ivkbl.get_signature().get_string(), " called"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment