summaryrefslogtreecommitdiff
path: root/src/scripts
diff options
context:
space:
mode:
authorDave Andreoli <dave@gurumeditation.it>2018-03-11 15:52:52 +0100
committerDave Andreoli <dave@gurumeditation.it>2018-03-11 15:52:52 +0100
commit2355df0e4f20dfa9cf322be7521f7916ad1ea9c5 (patch)
treea75dfb57a9874b6636ee76edc9c65b6ef25b0d09 /src/scripts
parent752a6b107018f692705c184b4952045d2130fd6f (diff)
Pyolian: remove the useless Object.type binding
This is useless in py as Objects are never returned directly, you always get the correct subtype (Class, Variable, etc..). It was also clashing with Class.type
Diffstat (limited to 'src/scripts')
-rw-r--r--src/scripts/pyolian/eolian.py70
-rwxr-xr-xsrc/scripts/pyolian/test_eolian.py5
2 files changed, 33 insertions, 42 deletions
diff --git a/src/scripts/pyolian/eolian.py b/src/scripts/pyolian/eolian.py
index 42468313bc..809ec35b2c 100644
--- a/src/scripts/pyolian/eolian.py
+++ b/src/scripts/pyolian/eolian.py
@@ -37,23 +37,6 @@ _already_halted = False
37 37
38### Eolian Enums ############################################################ 38### Eolian Enums ############################################################
39 39
40class Eolian_Object_Type(IntEnum):
41 UNKNOWN = 0
42 CLASS = 1
43 TYPEDECL = 2
44 STRUCT_FIELD = 3
45 ENUM_FIELD = 4
46 TYPE = 5
47 VARIABLE = 6
48 EXPRESSION = 7
49 FUNCTION = 8
50 FUNCTION_PARAMETER = 9
51 EVENT = 10
52 PART = 11
53 IMPLEMENT = 12
54 CONSTRUCTOR = 13
55 DOCUMENTATION = 14
56
57class Eolian_Function_Type(IntEnum): 40class Eolian_Function_Type(IntEnum):
58 UNRESOLVED = 0 41 UNRESOLVED = 0
59 PROPERTY = 1 42 PROPERTY = 1
@@ -661,10 +644,6 @@ class Object(EolianBaseObject):
661 def column(self): 644 def column(self):
662 return int(lib.eolian_object_column_get(self._obj)) 645 return int(lib.eolian_object_column_get(self._obj))
663 646
664 @cached_property
665 def type(self):
666 return Eolian_Object_Type(lib.eolian_object_type_get(self._obj))
667
668 647
669class Class(Object): 648class Class(Object):
670 def __repr__(self): 649 def __repr__(self):
@@ -1556,24 +1535,41 @@ def _str_to_py(s):
1556 print('WARNING !!!!!!!!! Unknown type: %s' % type(s)) 1535 print('WARNING !!!!!!!!! Unknown type: %s' % type(s))
1557 1536
1558 1537
1559### internal Object type -> class mapping ################################### 1538### internal Object type -> Class mapping ###################################
1539
1540class _Eolian_Object_Type(IntEnum):
1541 UNKNOWN = 0
1542 CLASS = 1
1543 TYPEDECL = 2
1544 STRUCT_FIELD = 3
1545 ENUM_FIELD = 4
1546 TYPE = 5
1547 VARIABLE = 6
1548 EXPRESSION = 7
1549 FUNCTION = 8
1550 FUNCTION_PARAMETER = 9
1551 EVENT = 10
1552 PART = 11
1553 IMPLEMENT = 12
1554 CONSTRUCTOR = 13
1555 DOCUMENTATION = 14
1560 1556
1561_eolian_type_class_mapping = { 1557_eolian_type_class_mapping = {
1562 Eolian_Object_Type.UNKNOWN: Object, 1558 _Eolian_Object_Type.UNKNOWN: Object,
1563 Eolian_Object_Type.CLASS: Class, 1559 _Eolian_Object_Type.CLASS: Class,
1564 Eolian_Object_Type.TYPEDECL: Typedecl, 1560 _Eolian_Object_Type.TYPEDECL: Typedecl,
1565 Eolian_Object_Type.STRUCT_FIELD: Struct_Type_Field, 1561 _Eolian_Object_Type.STRUCT_FIELD: Struct_Type_Field,
1566 Eolian_Object_Type.ENUM_FIELD: Enum_Type_Field, 1562 _Eolian_Object_Type.ENUM_FIELD: Enum_Type_Field,
1567 Eolian_Object_Type.TYPE: Type, 1563 _Eolian_Object_Type.TYPE: Type,
1568 Eolian_Object_Type.VARIABLE: Variable, 1564 _Eolian_Object_Type.VARIABLE: Variable,
1569 Eolian_Object_Type.EXPRESSION: Expression, 1565 _Eolian_Object_Type.EXPRESSION: Expression,
1570 Eolian_Object_Type.FUNCTION: Function, 1566 _Eolian_Object_Type.FUNCTION: Function,
1571 Eolian_Object_Type.FUNCTION_PARAMETER: Function_Parameter, 1567 _Eolian_Object_Type.FUNCTION_PARAMETER: Function_Parameter,
1572 Eolian_Object_Type.EVENT: Event, 1568 _Eolian_Object_Type.EVENT: Event,
1573 Eolian_Object_Type.PART: Part, 1569 _Eolian_Object_Type.PART: Part,
1574 Eolian_Object_Type.IMPLEMENT: Implement, 1570 _Eolian_Object_Type.IMPLEMENT: Implement,
1575 Eolian_Object_Type.CONSTRUCTOR: Constructor, 1571 _Eolian_Object_Type.CONSTRUCTOR: Constructor,
1576 Eolian_Object_Type.DOCUMENTATION: Documentation, 1572 _Eolian_Object_Type.DOCUMENTATION: Documentation,
1577} 1573}
1578 1574
1579### module init/shutdown #################################################### 1575### module init/shutdown ####################################################
diff --git a/src/scripts/pyolian/test_eolian.py b/src/scripts/pyolian/test_eolian.py
index 41f3bf7398..8740837f39 100755
--- a/src/scripts/pyolian/test_eolian.py
+++ b/src/scripts/pyolian/test_eolian.py
@@ -275,11 +275,6 @@ class TestEolianObject(unittest.TestCase):
275 obj = eolian_db.object_by_name_get('Efl.Ui.Frame') 275 obj = eolian_db.object_by_name_get('Efl.Ui.Frame')
276 self.assertEqual(obj.name, 'Efl.Ui.Frame') 276 self.assertEqual(obj.name, 'Efl.Ui.Frame')
277 277
278 @unittest.expectedFailure # Object.type clash with Class.type
279 def test_type(self):
280 obj = eolian_db.object_by_name_get('Efl.Ui.Frame')
281 self.assertIs(obj.type, eolian.Eolian_Object_Type.CLASS)
282
283 def test_file(self): 278 def test_file(self):
284 obj = eolian_db.object_by_name_get('Efl.Ui.Frame') 279 obj = eolian_db.object_by_name_get('Efl.Ui.Frame')
285 self.assertEqual(obj.file, 'efl_ui_frame.eo') 280 self.assertEqual(obj.file, 'efl_ui_frame.eo')