WARNING! Access to this system is limited to authorised users only.
Unauthorised users may be subject to prosecution.
Unauthorised access to this system is a criminal offence under Australian law (Federal Crimes Act 1914 Part VIA)
It is a criminal offence to:
(1) Obtain access to data without authority. -Penalty 2 years imprisonment.
(2) Damage, delete, alter or insert data without authority. -Penalty 10 years imprisonment.
User activity is monitored and recorded. Anyone using this system expressly consents to such monitoring and recording.

To protect your data, the CISO officer has suggested users to enable 2FA as soon as possible.
Currently 2.6% of users enabled 2FA.

class_primitives.py 1.15 KB
Newer Older
1 2
from som.primitives.primitives import Primitives

Stefan Marr's avatar
Stefan Marr committed
3 4
from som.vmobjects.primitive   import Primitive

5

6 7 8 9
def _new(ivkbl, frame, interpreter):
    rcvr = frame.pop()
    frame.push(interpreter.get_universe().new_instance(rcvr))

Stefan Marr's avatar
Stefan Marr committed
10

11 12 13 14
def _name(ivkbl, frame, interpreter):
    rcvr = frame.pop()
    frame.push(rcvr.get_name())

Stefan Marr's avatar
Stefan Marr committed
15

16 17 18 19
def _super_class(ivkbl, frame, interpreter):
    rcvr = frame.pop()
    frame.push(rcvr.get_super_class())

Stefan Marr's avatar
Stefan Marr committed
20

21 22 23
def _methods(ivkbl, frame, interpreter):
    rcvr = frame.pop()
    frame.push(rcvr.get_instance_invokables())
Stefan Marr's avatar
Stefan Marr committed
24 25


26 27 28 29
def _fields(ivkbl, frame, interpreter):
    rcvr = frame.pop()
    frame.push(rcvr.get_instance_fields())

30 31
class ClassPrimitives(Primitives):
    def install_primitives(self):
32 33 34 35 36
        self._install_instance_primitive(Primitive("new",        self._universe, _new))
        self._install_instance_primitive(Primitive("name",       self._universe, _name))
        self._install_instance_primitive(Primitive("superclass", self._universe, _super_class))
        self._install_instance_primitive(Primitive("methods",    self._universe, _methods))
        self._install_instance_primitive(Primitive("fields",     self._universe, _fields))