Skip to content

Commit fd57cce

Browse files
committed
feat: fix module AST cache
1 parent c039e4e commit fd57cce

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

pykokkos/core/compiler.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,9 @@ def compile_object(
181181
# Avoid fusing the ASTs before checking if it was already compiled
182182
entity, classtypes = self.fuse_objects(metadata, fuse_ASTs=False, **kwargs)
183183

184-
hash: str = self.members_hash(entity.path, entity.name, types_signature)
184+
hash: str = self.members_hash(
185+
entity.path, entity.name, module_setup.ast_signature, types_signature
186+
)
185187

186188
types_inferred: bool = updated_types is not None
187189
decorator_inferred: bool = updated_decorator is not None
@@ -413,21 +415,26 @@ def read_defaults(self) -> Optional[CompilationDefaults]:
413415
return defaults
414416

415417
def members_hash(
416-
self, path: List[str], name: str, types_signature: Optional[str]
418+
self,
419+
path: List[str],
420+
name: str,
421+
ast_signature: str,
422+
types_signature: Optional[str],
417423
) -> str:
418424
"""
419425
Map from entity path and name to a string to index members
420426
421427
:param path: the path to the file containing the entity
422428
:param name: the name of the entity
429+
:param ast_signature: signature of the translated AST and dependencies
423430
:param types_signature: string signature of inferred parameter types
424431
:returns: the hash of the entity
425432
"""
426433

427434
return (
428-
f"{path}_{name}"
435+
f"{path}_{name}_{ast_signature}"
429436
if types_signature is None
430-
else f"{path}_{name}_{types_signature}"
437+
else f"{path}_{name}_{ast_signature}_{types_signature}"
431438
)
432439

433440
def extract_members(

0 commit comments

Comments
 (0)