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 773e3856 authored by Stefan Marr's avatar Stefan Marr
Browse files

Avoid over allocating for fields, and fix field name lookup, and make sure...


Avoid over allocating for fields, and fix field name lookup, and make sure that primitives on class-side are found as well

- the logic how classes are built was changed, all super-class fields are known, so they are already there and don't have to be added
Signed-off-by: default avatarStefan Marr <git@stefan-marr.de>
parent 46a37fbe
......@@ -126,37 +126,24 @@ class Class(Object):
std_println(" is not in class definition for class " + self.get_name().get_string())
def get_instance_field_name(self, index):
# Get the name of the instance field with the given index
if index >= self._get_number_of_super_instance_fields():
# Adjust the index to account for fields defined in the super class
index -= self._get_number_of_super_instance_fields()
# Return the symbol representing the instance fields name
return self.get_instance_fields().get_indexable_field(index)
else:
# Ask the super class to return the name of the instance field
return self.get_super_class().get_instance_field_name(index)
return self.get_instance_fields().get_indexable_field(index)
def get_number_of_instance_fields(self):
# Get the total number of instance fields in this class
return (self.get_instance_fields().get_number_of_indexable_fields() +
self._get_number_of_super_instance_fields())
return self.get_instance_fields().get_number_of_indexable_fields()
def _get_number_of_super_instance_fields(self):
# Get the total number of instance fields defined in super classes
if self.has_super_class():
return self.get_super_class().get_number_of_instance_fields()
else:
return 0
def has_primitives(self):
# Lookup invokable with given signature in array of instance invokables
for i in range(0, self.get_number_of_instance_invokables()):
@staticmethod
def _includes_primitives(clazz):
for i in range(0, clazz.get_number_of_instance_invokables()):
# Get the next invokable in the instance invokable array
if self.get_instance_invokable(i).is_primitive():
if clazz.get_instance_invokable(i).is_primitive():
return True
return False
def has_primitives(self):
return (self._includes_primitives(self) or
self._includes_primitives(self._class))
def load_primitives(self):
from som.primitives.known import (primitives_for_class,
PrimitivesNotFound)
......
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