Skip to content
This repository was archived by the owner on Sep 12, 2024. It is now read-only.

Commit c840593

Browse files
committed
temporary
1 parent 1e8f8f1 commit c840593

File tree

8 files changed

+253
-159
lines changed

8 files changed

+253
-159
lines changed

jaclang/cli/cli.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
from jaclang.compiler.passes.main.pyast_load_pass import PyastBuildPass
1919
from jaclang.compiler.passes.main.schedules import py_code_gen_typed
2020
from jaclang.compiler.passes.tool.schedules import format_pass
21-
from jaclang.core.constructs import ObjectAnchor
21+
from jaclang.core.constructs import NodeAnchor, ObjectAnchor
2222
from jaclang.plugin.builtin import dotgen
2323
from jaclang.plugin.feature import JacCmd as Cmd
2424
from jaclang.plugin.feature import JacFeature as Jac
@@ -86,7 +86,9 @@ def run(
8686
else ""
8787
)
8888

89-
jctx = Jac.context("test.session", {"root": root, "entry": node})
89+
jctx = Jac.context(
90+
session, {"root": NodeAnchor.ref(root), "entry": NodeAnchor.ref(node)}
91+
)
9092

9193
base, mod = os.path.split(filename)
9294
base = base if base else "./"
@@ -135,11 +137,12 @@ def get_object(id: str, session: str = "") -> dict[str, Any]:
135137
architype = None
136138

137139
if id == "root":
138-
state = jctx.root.__getstate__()
139-
architype = state["architype"] = jctx.root.architype.__getstate__()
140-
elif (of := ObjectAnchor.ref(id)) and (oa := of.sync()):
141-
state = oa.__getstate__()
142-
architype = state["architype"] = oa.architype.__getstate__()
140+
super_root = jctx.super_root
141+
state = super_root.__getstate__()
142+
architype = state["architype"] = super_root.architype.__getstate__()
143+
elif (anchor := ObjectAnchor.ref(id)) and (architype := anchor.sync()):
144+
state = anchor.__getstate__()
145+
architype = state["architype"] = architype.__getstate__()
143146

144147
if isinstance(architype, dict):
145148
architype.pop("_jac_", None)
@@ -423,7 +426,7 @@ def start_cli() -> None:
423426
if command:
424427
args_dict = vars(args)
425428
args_dict.pop("command")
426-
if command not in ["run"]:
429+
if command.func.__name__ != "run":
427430
args_dict.pop("session")
428431
ret = command.call(**args_dict)
429432
if ret:

0 commit comments

Comments
 (0)