|
18 | 18 | from jaclang.compiler.passes.main.pyast_load_pass import PyastBuildPass |
19 | 19 | from jaclang.compiler.passes.main.schedules import py_code_gen_typed |
20 | 20 | from jaclang.compiler.passes.tool.schedules import format_pass |
21 | | -from jaclang.core.constructs import ObjectAnchor |
| 21 | +from jaclang.core.constructs import NodeAnchor, ObjectAnchor |
22 | 22 | from jaclang.plugin.builtin import dotgen |
23 | 23 | from jaclang.plugin.feature import JacCmd as Cmd |
24 | 24 | from jaclang.plugin.feature import JacFeature as Jac |
@@ -86,7 +86,9 @@ def run( |
86 | 86 | else "" |
87 | 87 | ) |
88 | 88 |
|
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 | + ) |
90 | 92 |
|
91 | 93 | base, mod = os.path.split(filename) |
92 | 94 | base = base if base else "./" |
@@ -135,11 +137,12 @@ def get_object(id: str, session: str = "") -> dict[str, Any]: |
135 | 137 | architype = None |
136 | 138 |
|
137 | 139 | 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__() |
143 | 146 |
|
144 | 147 | if isinstance(architype, dict): |
145 | 148 | architype.pop("_jac_", None) |
@@ -423,7 +426,7 @@ def start_cli() -> None: |
423 | 426 | if command: |
424 | 427 | args_dict = vars(args) |
425 | 428 | args_dict.pop("command") |
426 | | - if command not in ["run"]: |
| 429 | + if command.func.__name__ != "run": |
427 | 430 | args_dict.pop("session") |
428 | 431 | ret = command.call(**args_dict) |
429 | 432 | if ret: |
|
0 commit comments