onejs-sl 0.1.6 → 0.1.7
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/CHANGELOG.md +6 -0
- package/README.md +19 -5
- package/package.json +1 -1
- package/src/lang/check.ts +18 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.7
|
|
4
|
+
|
|
5
|
+
`diagnose` finds a mistake inside a refused call's arguments and on both sides of an operator, found by the Play editor's first run in a real browser. Nothing a program compiles to changes.
|
|
6
|
+
|
|
7
|
+
- `fract(uv * wrap)` reports both `fract` and `wrap`
|
|
8
|
+
|
|
3
9
|
## 0.1.6
|
|
4
10
|
|
|
5
11
|
`diagnose(source)` returns every error in a file, for an editor checking as it is typed (`Specs/SL_NEXT.md` 5). Nothing a program compiles to changes.
|
package/README.md
CHANGED
|
@@ -159,11 +159,25 @@ and QuickJS (Magerie). Two checks hold it to that:
|
|
|
159
159
|
|
|
160
160
|
Push a tag `v<version>` matching `package.json`; `.github/workflows/publish.yml`
|
|
161
161
|
publishes through npm trusted publishing (OIDC), so no token exists anywhere.
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
162
|
+
Before the tag:
|
|
163
|
+
|
|
164
|
+
1. Note the release in `CHANGELOG.md` and bump `package.json`.
|
|
165
|
+
2. Prove the corpus: a program that compiled before compiles to the same bytes,
|
|
166
|
+
unless the release says otherwise.
|
|
167
|
+
3. Run PlaySite's checks in the container, where the Play editor bundles this
|
|
168
|
+
package: `node scripts/gen-sl-parser.mjs`, then `npx vitest run`, in
|
|
169
|
+
`PlaySite/`. It is a private repo, so no workflow here can.
|
|
170
|
+
4. Push `main` and wait for CI, whose `consumers` job runs onejs-unity's
|
|
171
|
+
typecheck and tests against the commit (`consumers.yml`). `publish.yml`
|
|
172
|
+
runs the same job and publishes nothing if it fails. When a consumer has to
|
|
173
|
+
follow a change, land it here, fix the consumer, then re-run and tag.
|
|
174
|
+
|
|
175
|
+
The one exception to publishing by tag is the first version: npm attaches a
|
|
176
|
+
trusted publisher to a package that already exists, so 0.1.0 was published by
|
|
177
|
+
hand, and the workflow checks its tag and publishes nothing. In the OneJS
|
|
178
|
+
container this package is checked out at `JSModules/onejs-sl`, and
|
|
179
|
+
`onejs-unity` links it with `file:../onejs-sl` as a dev dependency beside its
|
|
180
|
+
`^` peer range.
|
|
167
181
|
|
|
168
182
|
## The one idea
|
|
169
183
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "onejs-sl",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"description": "The OneJS shader language: a small typed language for per pixel programs, compiled to a portable IR and emitted as HLSL, WGSL, GLSL ES or a VM buffer",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"types": "src/index.ts",
|
package/src/lang/check.ts
CHANGED
|
@@ -453,20 +453,31 @@ export function check(unit: Unit, prelude: FuncDecl[], options: CheckOptions = {
|
|
|
453
453
|
}
|
|
454
454
|
checkExpr(fn, e.obj, scope)
|
|
455
455
|
return
|
|
456
|
-
case "call":
|
|
457
|
-
checkCall(fn, e, scope)
|
|
456
|
+
case "call": {
|
|
457
|
+
if (attempt(() => checkCall(fn, e, scope))) return
|
|
458
|
+
// Only reached while collecting: the call was refused, and its
|
|
459
|
+
// arguments are separate questions, so a mistake inside one is
|
|
460
|
+
// not hidden by the call's own. `fract(uv * wrap)` is two
|
|
461
|
+
// mistakes. tex2D's first argument is the texture, which is a
|
|
462
|
+
// value only there.
|
|
463
|
+
const tex = e.callee.k === "ident" && e.callee.name === "tex2D"
|
|
464
|
+
for (const a of tex ? e.args.slice(1) : e.args) attempt(() => checkExpr(fn, a, scope))
|
|
458
465
|
return
|
|
466
|
+
}
|
|
467
|
+
// Each operand on its own, so that while collecting a mistake on one
|
|
468
|
+
// side does not hide one on the other. Without a collector, `attempt`
|
|
469
|
+
// is the plain call, and the first error throws as it always did.
|
|
459
470
|
case "unary":
|
|
460
471
|
checkExpr(fn, e.arg, scope)
|
|
461
472
|
return
|
|
462
473
|
case "binary":
|
|
463
|
-
checkExpr(fn, e.a, scope)
|
|
464
|
-
checkExpr(fn, e.b, scope)
|
|
474
|
+
attempt(() => checkExpr(fn, e.a, scope))
|
|
475
|
+
attempt(() => checkExpr(fn, e.b, scope))
|
|
465
476
|
return
|
|
466
477
|
case "cond":
|
|
467
|
-
checkExpr(fn, e.cond, scope)
|
|
468
|
-
checkExpr(fn, e.then, scope)
|
|
469
|
-
checkExpr(fn, e.else, scope)
|
|
478
|
+
attempt(() => checkExpr(fn, e.cond, scope))
|
|
479
|
+
attempt(() => checkExpr(fn, e.then, scope))
|
|
480
|
+
attempt(() => checkExpr(fn, e.else, scope))
|
|
470
481
|
return
|
|
471
482
|
}
|
|
472
483
|
}
|