@onda-lang/binaryen-web 0.8.2 → 0.8.3

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/api.md CHANGED
@@ -119,7 +119,11 @@ versions rather than guessing layout compatibility.
119
119
  ### Parameter controls
120
120
 
121
121
  `createParamControl(metadata)` validates one scalar parameter descriptor and returns a reusable
122
- `OndaPreparedParamControl`. `createParamDomain(domain)` does the same from already-decoded values.
122
+ `OndaPreparedParamControl`. For an array, `createParamControl(metadata, index)` prepares one element;
123
+ `paramElementMetadata(metadata, index)` projects its scalar descriptor, default, and storage offset.
124
+ The Web Audio adapter accepts indexed names such as `offsets[1]` in `setParam` and
125
+ `setParamNormalized`, and exact-length arrays in `setParam("offsets", values)`.
126
+ `createParamDomain(domain)` does the same from already-decoded values.
123
127
  Prepared controls expose `constrainPlain`, `normalizedToPlain`, and `plainToNormalized` methods.
124
128
 
125
129
  The one-shot `constrainParamPlain`, `paramNormalizedToPlain`, and `paramPlainToNormalized`
@@ -271,6 +275,7 @@ PROCESSOR_INIT_PRESERVE_PINNED
271
275
  PROCESSOR_SNAPSHOT_FORMAT_VERSION
272
276
  constrainParamPlain
273
277
  createParamControl
278
+ paramElementMetadata
274
279
  createParamDomain
275
280
  createProcessorArtifactFiles
276
281
  decodeDelegateRecords
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onda-lang/binaryen-web",
3
- "version": "0.8.2",
3
+ "version": "0.8.3",
4
4
  "type": "module",
5
5
  "description": "Binaryen backend for versioned Onda MIR in browsers and Node.js",
6
6
  "license": "MIT",
@@ -46,7 +46,7 @@
46
46
  "verify-mir": "node ./scripts/verify-mir.mjs"
47
47
  },
48
48
  "dependencies": {
49
- "@onda-lang/processor-abi": "0.8.2",
49
+ "@onda-lang/processor-abi": "0.8.3",
50
50
  "binaryen": "130.0.0"
51
51
  },
52
52
  "publishConfig": {
@@ -1689,7 +1689,7 @@ export class MirCompiler extends MirCompilerLowering {
1689
1689
  default_reprs: this.constantReprs(param.default),
1690
1690
  range_min_repr: this.scalarRepr(param.range?.min),
1691
1691
  range_max_repr: this.scalarRepr(param.range?.max),
1692
- param_control: this.storageShape(param.ty).length === 1 && param.range
1692
+ param_control: param.range
1693
1693
  ? {
1694
1694
  scale: param.control.scale,
1695
1695
  curve: param.control.curve,
@@ -44,7 +44,21 @@ export class MirCompilerLowering extends MirCompilerCore {
44
44
  );
45
45
  }
46
46
  }
47
- if (this.type(this.placeTypeId(data.destination, context)).kind === "slice") {
47
+ const destinationType = this.placeTypeId(data.destination, context);
48
+ if (this.type(destinationType).kind === "array") {
49
+ const source = data.value.kind === "load"
50
+ ? data.value.data
51
+ : data.value.kind === "use" && data.value.data.kind === "local"
52
+ ? { base: data.value.data, projections: [] }
53
+ : null;
54
+ if (!source) this.fail("array assignment requires an array load or local value");
55
+ return this.module.memory.copy(
56
+ this.placeAddress(data.destination, context),
57
+ this.placeAddress(source, context),
58
+ this.module.i32.const(this.typeLayout(destinationType).size),
59
+ );
60
+ }
61
+ if (this.type(destinationType).kind === "slice") {
48
62
  return this.storeSlicePlace(
49
63
  data.destination,
50
64
  this.compileSliceRvalue(data.value, context),