Skip to content

Commit

Permalink
fix mtllm test failiures
Browse files Browse the repository at this point in the history
  • Loading branch information
Jayanaka-98 committed Oct 30, 2024
1 parent 889db8e commit 0e95d4c
Showing 1 changed file with 8 additions and 27 deletions.
35 changes: 8 additions & 27 deletions jac/jaclang/plugin/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -1065,16 +1065,10 @@ def get_semstr_type(
file_loc: str, scope: str, attr: str, return_semstr: bool
) -> Optional[str]:
"""Jac's get_semstr_type feature."""
from jaclang.runtimelib.machine import JacMachine
from jaclang.compiler.semtable import SemInfo, SemScope
_scope = SemScope.get_scope_from_str(scope)
with open(
os.path.join(
os.path.dirname(file_loc),
"__jac_gen__",
os.path.basename(file_loc).replace(".jac", ".registry.pkl"),
),
"rb",
) as f:
mod_registry: SemRegistry = pickle.load(f)
mod_registry: SemRegistry = JacMachine.get().jac_program.SemIR
_, attr_seminfo = mod_registry.lookup(_scope, attr)
if attr_seminfo and isinstance(attr_seminfo, SemInfo):
return attr_seminfo.semstr if return_semstr else attr_seminfo.type
Expand All @@ -1084,15 +1078,8 @@ def get_semstr_type(
@hookimpl
def obj_scope(file_loc: str, attr: str) -> str:
"""Jac's gather_scope feature."""
with open(
os.path.join(
os.path.dirname(file_loc),
"__jac_gen__",
os.path.basename(file_loc).replace(".jac", ".registry.pkl"),
),
"rb",
) as f:
mod_registry: SemRegistry = pickle.load(f)
from jaclang.runtimelib.machine import JacMachine
mod_registry: SemRegistry = JacMachine.get().jac_program.SemIR

attr_scope = None
for x in attr.split("."):
Expand Down Expand Up @@ -1125,15 +1112,9 @@ def obj_scope(file_loc: str, attr: str) -> str:
@hookimpl
def get_sem_type(file_loc: str, attr: str) -> tuple[str | None, str | None]:
"""Jac's get_semstr_type implementation."""
with open(
os.path.join(
os.path.dirname(file_loc),
"__jac_gen__",
os.path.basename(file_loc).replace(".jac", ".registry.pkl"),
),
"rb",
) as f:
mod_registry: SemRegistry = pickle.load(f)
from jaclang.runtimelib.machine import JacMachine
from jaclang.compiler.semtable import SemInfo, SemScope
mod_registry: SemRegistry = JacMachine.get().jac_program.SemIR

attr_scope = None
for x in attr.split("."):
Expand Down

0 comments on commit 0e95d4c

Please sign in to comment.