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.7% of users enabled 2FA.

Commit 5865b2c0 authored by Stefan Marr's avatar Stefan Marr
Browse files

Pass class in Object constructor to avoid set afterwards


Signed-off-by: default avatarStefan Marr <git@stefan-marr.de>
parent 038bffe8
......@@ -378,9 +378,7 @@ class Universe(object):
num_bytecodes, signature)
def new_instance(self, instance_class):
result = Object(self.nilObject, instance_class.get_number_of_instance_fields())
result.set_class(instance_class)
return result
return Object(self.nilObject, instance_class.get_number_of_instance_fields(), instance_class)
@staticmethod
def new_integer(value):
......
......@@ -8,10 +8,11 @@ class Object(AbstractObject):
# Static field indices and number of object fields
NUMBER_OF_OBJECT_FIELDS = 0
def __init__(self, nilObject, number_of_fields = -1):
num_fields = number_of_fields if number_of_fields != -1 else self._get_default_number_of_fields()
def __init__(self, nilObject, number_of_fields = -1, obj_class = None):
num_fields = (number_of_fields if number_of_fields != -1
else self._get_default_number_of_fields())
self._fields = [nilObject] * num_fields
self._class = nilObject
self._class = obj_class or nilObject
def get_class(self, universe):
return self._class
......
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