jaclang 0.7.30__py3-none-any.whl → 0.7.32__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of jaclang might be problematic. Click here for more details.

Files changed (35) hide show
  1. jaclang/__init__.py +419 -3
  2. jaclang/compiler/absyntree.py +3 -3
  3. jaclang/compiler/constant.py +4 -4
  4. jaclang/compiler/jac.lark +226 -175
  5. jaclang/compiler/parser.py +1772 -2422
  6. jaclang/compiler/passes/main/fuse_typeinfo_pass.py +2 -2
  7. jaclang/compiler/passes/main/import_pass.py +2 -1
  8. jaclang/compiler/passes/main/inheritance_pass.py +20 -1
  9. jaclang/compiler/passes/main/pyast_gen_pass.py +565 -723
  10. jaclang/compiler/passes/main/tests/test_type_check_pass.py +6 -3
  11. jaclang/compiler/tests/test_parser.py +13 -5
  12. jaclang/plugin/builtin.py +11 -0
  13. jaclang/plugin/default.py +64 -10
  14. jaclang/plugin/feature.py +14 -0
  15. jaclang/plugin/spec.py +16 -0
  16. jaclang/plugin/tests/fixtures/graph_purger.jac +2 -0
  17. jaclang/plugin/tests/fixtures/other_root_access.jac +1 -0
  18. jaclang/plugin/tests/fixtures/savable_object.jac +2 -0
  19. jaclang/plugin/tests/fixtures/traversing_save.jac +17 -0
  20. jaclang/plugin/tests/test_jaseci.py +34 -1
  21. jaclang/runtimelib/architype.py +9 -19
  22. jaclang/runtimelib/context.py +25 -9
  23. jaclang/settings.py +2 -0
  24. jaclang/tests/fixtures/base_class_complex_expr.jac +38 -0
  25. jaclang/tests/fixtures/create_dynamic_architype.jac +1 -1
  26. jaclang/tests/fixtures/nested_impls.jac +55 -0
  27. jaclang/tests/test_cli.py +21 -0
  28. jaclang/tests/test_language.py +27 -13
  29. jaclang/tests/test_reference.py +2 -2
  30. jaclang/utils/helpers.py +4 -3
  31. jaclang/utils/profiler.py +62 -0
  32. {jaclang-0.7.30.dist-info → jaclang-0.7.32.dist-info}/METADATA +1 -1
  33. {jaclang-0.7.30.dist-info → jaclang-0.7.32.dist-info}/RECORD +35 -31
  34. {jaclang-0.7.30.dist-info → jaclang-0.7.32.dist-info}/WHEEL +1 -1
  35. {jaclang-0.7.30.dist-info → jaclang-0.7.32.dist-info}/entry_points.txt +0 -0
@@ -604,8 +604,8 @@ class FuseTypeInfoPass(Pass):
604
604
  node_type: str = ""
605
605
 
606
606
  # left type is a list
607
- if left.expr_type.startswith("builtins.list["):
608
- node_type = left.expr_type[len("builtins.list[") : -1]
607
+ if left.expr_type.startswith(("builtins.list[", "jaclang.JacList[")):
608
+ node_type = left.expr_type[left.expr_type.find("[") + 1 : -1]
609
609
 
610
610
  # right index slice is a range then it's type is the same as left
611
611
  if right.is_range:
@@ -472,7 +472,8 @@ class PyImportPass(JacImportPass):
472
472
  if mod:
473
473
  mod.name = imported_mod_name if imported_mod_name else mod.name
474
474
  if mod.name == "__init__":
475
- mod_name = mod.loc.mod_path.split(os.sep)[-2]
475
+ # (thakee): This needs to be re-done after implementing path handling properly.
476
+ mod_name = mod.loc.mod_path.split(os.path.sep)[-2]
476
477
  self.__debug_print(
477
478
  f"\tRaised the __init__ file and rename the mod to be {mod_name}"
478
479
  )
@@ -34,7 +34,7 @@ class InheritancePass(Pass):
34
34
  for item in node.base_classes.items:
35
35
  # The assumption is that the base class can only be a name node
36
36
  # or an atom trailer only.
37
- assert isinstance(item, (ast.Name, ast.AtomTrailer))
37
+ assert isinstance(item, (ast.Name, ast.AtomTrailer, ast.FuncCall))
38
38
 
39
39
  # In case of name node, then get the symbol table that contains
40
40
  # the current class and lookup for that name after that use the
@@ -63,6 +63,11 @@ class InheritancePass(Pass):
63
63
  assert base_class_symbol_table is not None
64
64
  node.sym_tab.inherit_sym_tab(base_class_symbol_table)
65
65
 
66
+ elif isinstance(item, ast.FuncCall):
67
+ self.__debug_print(
68
+ "Base class depends on the type of a function call expression, this is not supported yet"
69
+ )
70
+
66
71
  # In case of atom trailer, unwind it and use each name node to
67
72
  # as the code above to lookup for the base class
68
73
  elif isinstance(item, ast.AtomTrailer):
@@ -94,6 +99,20 @@ class InheritancePass(Pass):
94
99
  not_found = True
95
100
  break
96
101
 
102
+ if (
103
+ current_sym_table is None
104
+ and item.as_attr_list.index(name) < len(item.as_attr_list) - 1
105
+ and isinstance(
106
+ item.as_attr_list[item.as_attr_list.index(name) + 1],
107
+ ast.IndexSlice,
108
+ )
109
+ ):
110
+ msg = "Base class depends on the type of an "
111
+ msg += "Index slice expression, this is not supported yet"
112
+ self.__debug_print(msg)
113
+ not_found = True
114
+ break
115
+
97
116
  assert current_sym_table is not None
98
117
 
99
118
  if not_found: