behavior-contracts 0.2.4 → 0.2.5
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.
- package/dist/generator/emit-straightline-go.d.ts +27 -46
- package/dist/generator/emit-straightline-go.d.ts.map +1 -1
- package/dist/generator/emit-straightline-go.js +688 -190
- package/dist/generator/emit-straightline-go.js.map +1 -1
- package/dist/generator/emit-straightline-php.d.ts +1 -1
- package/dist/generator/emit-straightline-php.d.ts.map +1 -1
- package/dist/generator/emit-straightline-php.js +451 -20
- package/dist/generator/emit-straightline-php.js.map +1 -1
- package/dist/generator/emit-straightline-python.d.ts.map +1 -1
- package/dist/generator/emit-straightline-python.js +426 -22
- package/dist/generator/emit-straightline-python.js.map +1 -1
- package/dist/generator/emit-straightline-rust.d.ts +5 -0
- package/dist/generator/emit-straightline-rust.d.ts.map +1 -1
- package/dist/generator/emit-straightline-rust.js +596 -48
- package/dist/generator/emit-straightline-rust.js.map +1 -1
- package/dist/generator/emit-straightline-typed-go.d.ts.map +1 -1
- package/dist/generator/emit-straightline-typed-go.js +11 -3
- package/dist/generator/emit-straightline-typed-go.js.map +1 -1
- package/dist/generator/emit-straightline-typed-rust.d.ts.map +1 -1
- package/dist/generator/emit-straightline-typed-rust.js +20 -7
- package/dist/generator/emit-straightline-typed-rust.js.map +1 -1
- package/dist/generator/emit-straightline-typescript.d.ts +26 -15
- package/dist/generator/emit-straightline-typescript.d.ts.map +1 -1
- package/dist/generator/emit-straightline-typescript.js +703 -147
- package/dist/generator/emit-straightline-typescript.js.map +1 -1
- package/dist/generator/literal.d.ts +3 -1
- package/dist/generator/literal.d.ts.map +1 -1
- package/dist/generator/literal.js +13 -4
- package/dist/generator/literal.js.map +1 -1
- package/dist/generator/straightline.d.ts +81 -0
- package/dist/generator/straightline.d.ts.map +1 -1
- package/dist/generator/straightline.js +176 -0
- package/dist/generator/straightline.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,63 +1,48 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* emit-straightline-go.ts — Go 直線 emitter(bc#38 / Layer A2
|
|
2
|
+
* emit-straightline-go.ts — Go 直線 emitter(bc#38 / Layer A2 → bc#75 static-code rework)。
|
|
3
3
|
*
|
|
4
|
-
* typed-codegen.md §4.1 の Go 具体化。
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* **`RunBehavior` の tree-walk(nodeKind ディスパッチ / evalPorts / 汎用 output 評価)を
|
|
8
|
-
* 経由しない**(A1 と同じ骨組み)。
|
|
4
|
+
* typed-codegen.md §4.1 の Go 具体化。bc#75 で「解釈機構の転写」を排し、**本当の静的コード**を
|
|
5
|
+
* emit する(TS oracle と同じ static-wiring 解析 {@link sequentialOrder}/{@link analyzeSequentialOps}/
|
|
6
|
+
* {@link classifyExpr}/{@link isScopeFree} を消費する):
|
|
9
7
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* `
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
8
|
+
* - **逐次 plan(plan 無し / 全 stage 高々 1 op)は素の文列**として直線展開する。`RunPlan` も
|
|
9
|
+
* `[]OpSpec` テーブルも `baseScope()` snapshot も `exec` closure も `for k := range ops { if ops[k].ID== }`
|
|
10
|
+
* 線形探索も emit しない。ノード結果は素のローカル(`r_<id>`)に住み、skip 伝播(parent 連鎖 /
|
|
11
|
+
* bindField null-binding / continue policy)は静的に確定した分岐として展開する(Failure code /
|
|
12
|
+
* message は plan.go interpretOutcome と byte 一致)。
|
|
13
|
+
* - **静的形状の式はネイティブ inline**: string/bool/null リテラルは Go リテラル、静的 path の
|
|
14
|
+
* ref/refOpt は「ローカル直読み(配線は生成時に確定)+ field walk helper `slField`」、concat は
|
|
15
|
+
* 可変長 `slCat(...)`(評価済み値を受ける — closure も per-part func 値も無い)。
|
|
16
|
+
* - **per-expression scope snapshot を廃止**: scope を本当に読む residual dynamic 式(ref を含む
|
|
17
|
+
* primitive 経路)がある component だけが「進行形 scope(`scope *Obj`)」を組み、ノード完了ごとに
|
|
18
|
+
* 1 key を Set する。scope-free な primitive 式には空 scope 定数(`slEmpty()`)を渡す。
|
|
19
|
+
* - **RunPlan primitive は実並行 plan(複数 op の stage)だけ**が使う(bounded 並行の意味論 SSoT)。
|
|
20
|
+
* その経路も per-op exec は index で確定した switch(`for k := range ops` 線形探索は無い)。
|
|
21
|
+
*
|
|
22
|
+
* fail-closed 演算子意味論(overflow 算術・短絡 and/or/cond/coalesce・obj/arr 構築・比較・len・
|
|
23
|
+
* checked リテラル)は従来どおり A0 primitive SSoT(`Prim*`)を直呼びする(再実装しない)。
|
|
26
24
|
*
|
|
27
25
|
* この emitter は A1 の TS golden oracle と観測等価(値・発行 op 列・Failure)であることを
|
|
28
26
|
* conformance(codegen-straightline.test.ts の Go 節)で実 Go toolchain 実行により pin する。
|
|
29
27
|
*/
|
|
30
28
|
import type { EmitterPlugin } from "./core.js";
|
|
31
29
|
import { type ComponentPlan, type StraightlineDialect } from "./straightline.js";
|
|
30
|
+
export declare function setGoForceRunPlanHelpers(on: boolean): void;
|
|
32
31
|
/**
|
|
33
|
-
* emitExpr — Expression IR ノードを「scope を受けて (Value, error) を返す」Go
|
|
34
|
-
*
|
|
35
|
-
* 単純式は **native Go helper** へ(脱解釈 — AC#2)、overflow/短絡系は A0 primitive SSoT へ、
|
|
36
|
-
* むき出しスカラは EvalExpr(同一 SSoT)へ落とす。生成される Go 式はどれも `(Value, error)` を
|
|
37
|
-
* 返すので、直線関数側は `must(<expr>)` で 1 行に畳んで scope へ束ねる。
|
|
38
|
-
* - `{ref:[...]}` → `${PKG}.slRef(<path>, scope)` (native scope/field walk)
|
|
39
|
-
* - `{refOpt:[...]}` → `${PKG}? no — slRefOpt` (native, null 伝播)
|
|
40
|
-
* - `{concat:[...]}` → `slConcat([]slPart{...}, scope)` (native strings.Builder)
|
|
41
|
-
* - overflow/短絡 → `${PKG}.PrimAdd(...)` 等 (SSoT 直呼び)
|
|
42
|
-
* - bare scalar → `${PKG}.EvalExpr(<lit>, scope)` (SSoT)
|
|
43
|
-
* slRef/slRefOpt/slConcat は **生成モジュール内の native helper**(`EvaluateExpression`/`Prim*`
|
|
44
|
-
* を呼ばない)で、pure ref/concat の生成コードには evaluate/primitive 呼びが一切現れない
|
|
45
|
-
* (AC#2 の構造的 grep 証明)。
|
|
32
|
+
* emitExpr — Expression IR ノードを「scope を受けて (Value, error) を返す」Go 式に落とす
|
|
33
|
+
* (**dynamic 式専用**の legacy 経路 — RunPlan 経路と typed emitter が流用する seam)。
|
|
46
34
|
*/
|
|
47
35
|
declare function emitExpr(node: unknown, scopeVar: string): string;
|
|
36
|
+
/** component 名を Go 関数名に使える形へ(決定的。名前一意は DUPLICATE_COMPONENT で保証)。 */
|
|
37
|
+
declare function sanitize(name: string): string;
|
|
48
38
|
/** ops リテラル(RunPlan に渡す []OpSpec の Go リテラル)を綴じる。 */
|
|
49
39
|
declare function emitOpsLiteral(plan: ComponentPlan): string;
|
|
50
|
-
/** port ローカル変数名(Go
|
|
40
|
+
/** port ローカル変数名(Go 識別子として安全)。 */
|
|
51
41
|
declare function goPortVar(name: string): string;
|
|
52
42
|
/** behavior plan({groups, concurrency})を *ExecutionPlanSpec Go リテラルへ。 */
|
|
53
43
|
declare function emitBehaviorPlanLiteral(plan: unknown): string;
|
|
54
|
-
/** component 名を Go 関数名に使える形へ(決定的。名前一意は DUPLICATE_COMPONENT で保証)。 */
|
|
55
|
-
declare function sanitize(name: string): string;
|
|
56
44
|
/**
|
|
57
|
-
* go-typed(bc#47)が struct-native exec を綴じるために再利用する内部 emit ヘルパ。
|
|
58
|
-
* plan/handler-dispatch SSoT(RunPlan + ExecHandler + native/primitive port eval)をそのまま使い、
|
|
59
|
-
* 「結果を Value scope でなく struct scope に持つ」差分だけを typed 側で足すための seam。runtime 語彙
|
|
60
|
-
* (PKG)と ops/plan リテラル・式 emit を共有する(意味論の二重実装を避ける)。
|
|
45
|
+
* go-typed(bc#47)が struct-native exec を綴じるために再利用する内部 emit ヘルパ。
|
|
61
46
|
*/
|
|
62
47
|
export declare const goStraightlineInternals: {
|
|
63
48
|
PKG: string;
|
|
@@ -68,10 +53,6 @@ export declare const goStraightlineInternals: {
|
|
|
68
53
|
sanitize: typeof sanitize;
|
|
69
54
|
dialect: StraightlineDialect;
|
|
70
55
|
};
|
|
71
|
-
/**
|
|
72
|
-
* goStraightlineEmitter — 言語識別子 `"go-straightline"` の emitter plugin。
|
|
73
|
-
* 既存の `go`(リテラル焼き込み・endpoint 3-literal)と併存する additive な第2モード。
|
|
74
|
-
*/
|
|
75
56
|
export declare const goStraightlineEmitter: EmitterPlugin;
|
|
76
57
|
export {};
|
|
77
58
|
//# sourceMappingURL=emit-straightline-go.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"emit-straightline-go.d.ts","sourceRoot":"","sources":["../../src/generator/emit-straightline-go.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"emit-straightline-go.d.ts","sourceRoot":"","sources":["../../src/generator/emit-straightline-go.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,OAAO,KAAK,EAAe,aAAa,EAAE,MAAM,WAAW,CAAC;AAG5D,OAAO,EAQL,KAAK,aAAa,EAIlB,KAAK,mBAAmB,EACzB,MAAM,mBAAmB,CAAC;AA+B3B,wBAAgB,wBAAwB,CAAC,EAAE,EAAE,OAAO,GAAG,IAAI,CAE1D;AA8CD;;;GAGG;AACH,iBAAS,QAAQ,CAAC,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAuBzD;AAgHD,oEAAoE;AACpE,iBAAS,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEtC;AAkZD,oDAAoD;AACpD,iBAAS,cAAc,CAAC,IAAI,EAAE,aAAa,GAAG,MAAM,CASnD;AAmCD,iCAAiC;AACjC,iBAAS,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEvC;AAgND,yEAAyE;AACzE,iBAAS,uBAAuB,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAMtD;AA0PD;;GAEG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;CAQnC,CAAC;AAMF,eAAO,MAAM,qBAAqB,EAAE,aAMnC,CAAC"}
|