Warn when calling deprecated functions (#5447)

* Warn when calling deprecated std functions

Signed-off-by: Nick Cameron <nrc@ncameron.org>

* Refactor function values

Signed-off-by: Nick Cameron <nrc@ncameron.org>

---------

Signed-off-by: Nick Cameron <nrc@ncameron.org>
This commit is contained in:
Nick Cameron
2025-02-22 20:16:29 +13:00
committed by GitHub
parent 57f7d022ca
commit 3ddce116e5
86 changed files with 274 additions and 10811 deletions

View File

@ -9,7 +9,7 @@ Apply a function to every element of a list.
Given a list like `[a, b, c]`, and a function like `f`, returns `[f(a), f(b), f(c)]`
```js
map(array: [KclValue], map_fn: FunctionParam) -> [KclValue]
map(array: [KclValue], map_fn: FunctionSource) -> [KclValue]
```
@ -18,7 +18,7 @@ map(array: [KclValue], map_fn: FunctionParam) -> [KclValue]
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `array` | [`[KclValue]`](/docs/kcl/types/KclValue) | | Yes |
| `map_fn` | `FunctionParam` | | Yes |
| `map_fn` | `FunctionSource` | | Yes |
### Returns

View File

@ -35,7 +35,7 @@ The transform function returns a transform object. All properties of the object
- `rotation.origin` (either "local" i.e. rotate around its own center, "global" i.e. rotate around the scene's center, or a 3D point, defaults to "local")
```js
patternTransform(solid_set: SolidSet, instances: integer, transform: FunctionParam, use_original?: bool) -> [Solid]
patternTransform(solid_set: SolidSet, instances: integer, transform: FunctionSource, use_original?: bool) -> [Solid]
```
@ -45,7 +45,7 @@ patternTransform(solid_set: SolidSet, instances: integer, transform: FunctionPar
|----------|------|-------------|----------|
| `solid_set` | [`SolidSet`](/docs/kcl/types/SolidSet) | The solid(s) to duplicate | Yes |
| `instances` | `integer` | The number of total instances. Must be greater than or equal to 1. This includes the original entity. For example, if instances is 2, there will be two copies -- the original, and one new copy. If instances is 1, this has no effect. | Yes |
| `transform` | `FunctionParam` | How each replica should be transformed. The transform function takes a single parameter: an integer representing which number replication the transform is for. E.g. the first replica to be transformed will be passed the argument `1`. This simplifies your math: the transform function can rely on id `0` being the original instance passed into the `patternTransform`. See the examples. | Yes |
| `transform` | `FunctionSource` | How each replica should be transformed. The transform function takes a single parameter: an integer representing which number replication the transform is for. E.g. the first replica to be transformed will be passed the argument `1`. This simplifies your math: the transform function can rely on id `0` being the original instance passed into the `patternTransform`. See the examples. | Yes |
| `use_original` | `bool` | If the target was sketched on an extrusion, setting this will use the original sketch as the target, not the entire joined solid. Defaults to false. | No |
### Returns

View File

@ -9,7 +9,7 @@ Just like patternTransform, but works on 2D sketches not 3D solids.
```js
patternTransform2d(sketch_set: SketchSet, instances: integer, transform: FunctionParam, use_original?: bool) -> [Sketch]
patternTransform2d(sketch_set: SketchSet, instances: integer, transform: FunctionSource, use_original?: bool) -> [Sketch]
```
@ -19,7 +19,7 @@ patternTransform2d(sketch_set: SketchSet, instances: integer, transform: Functio
|----------|------|-------------|----------|
| `sketch_set` | [`SketchSet`](/docs/kcl/types/SketchSet) | The sketch(es) to duplicate | Yes |
| `instances` | `integer` | The number of total instances. Must be greater than or equal to 1. This includes the original entity. For example, if instances is 2, there will be two copies -- the original, and one new copy. If instances is 1, this has no effect. | Yes |
| `transform` | `FunctionParam` | How each replica should be transformed. The transform function takes a single parameter: an integer representing which number replication the transform is for. E.g. the first replica to be transformed will be passed the argument `1`. This simplifies your math: the transform function can rely on id `0` being the original instance passed into the `patternTransform`. See the examples. | Yes |
| `transform` | `FunctionSource` | How each replica should be transformed. The transform function takes a single parameter: an integer representing which number replication the transform is for. E.g. the first replica to be transformed will be passed the argument `1`. This simplifies your math: the transform function can rely on id `0` being the original instance passed into the `patternTransform`. See the examples. | Yes |
| `use_original` | `bool` | If the target was sketched on an extrusion, setting this will use the original sketch as the target, not the entire joined solid. Defaults to false. | No |
### Returns

View File

@ -9,7 +9,7 @@ Take a starting value. Then, for each element of an array, calculate the next va
using the previous value and the element.
```js
reduce(array: [KclValue], start: KclValue, reduce_fn: FunctionParam) -> KclValue
reduce(array: [KclValue], start: KclValue, reduce_fn: FunctionSource) -> KclValue
```
@ -19,7 +19,7 @@ reduce(array: [KclValue], start: KclValue, reduce_fn: FunctionParam) -> KclValue
|----------|------|-------------|----------|
| `array` | [`[KclValue]`](/docs/kcl/types/KclValue) | | Yes |
| `start` | [`KclValue`](/docs/kcl/types/KclValue) | Any KCL value. | Yes |
| `reduce_fn` | `FunctionParam` | | Yes |
| `reduce_fn` | `FunctionSource` | | Yes |
### Returns

View File

@ -141138,14 +141138,6 @@
"Function"
]
},
"memory": {
"allOf": [
{
"$ref": "#/components/schemas/EnvironmentRef"
}
],
"nullable": true
},
"__meta": {
"type": "array",
"items": {
@ -143279,28 +143271,6 @@
}
}
},
"EnvironmentRef": {
"description": "An index pointing to an environment at a point in time (either a snapshot or the current version, see the module docs).",
"type": "array",
"items": [
{
"type": "integer",
"format": "uint",
"minimum": 0.0
},
{
"$ref": "#/components/schemas/SnapshotRef"
}
],
"maxItems": 2,
"minItems": 2
},
"SnapshotRef": {
"description": "An index pointing to a snapshot within a specific (unspecified) environment.",
"type": "integer",
"format": "uint",
"minimum": 0.0
},
"ModuleId": {
"description": "Identifier of a source file. Uses a u32 to keep the size small.",
"type": "integer",
@ -143332,10 +143302,10 @@
},
{
"name": "map_fn",
"type": "FunctionParam",
"type": "FunctionSource",
"schema": {
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
"title": "FunctionParam",
"title": "FunctionSource",
"type": "null",
"definitions": {
"KclValue": {
@ -143756,14 +143726,6 @@
"Function"
]
},
"memory": {
"allOf": [
{
"$ref": "#/components/schemas/EnvironmentRef"
}
],
"nullable": true
},
"__meta": {
"type": "array",
"items": {
@ -145897,28 +145859,6 @@
}
}
},
"EnvironmentRef": {
"description": "An index pointing to an environment at a point in time (either a snapshot or the current version, see the module docs).",
"type": "array",
"items": [
{
"type": "integer",
"format": "uint",
"minimum": 0.0
},
{
"$ref": "#/components/schemas/SnapshotRef"
}
],
"maxItems": 2,
"minItems": 2
},
"SnapshotRef": {
"description": "An index pointing to a snapshot within a specific (unspecified) environment.",
"type": "integer",
"format": "uint",
"minimum": 0.0
},
"ModuleId": {
"description": "Identifier of a source file. Uses a u32 to keep the size small.",
"type": "integer",
@ -146378,14 +146318,6 @@
"Function"
]
},
"memory": {
"allOf": [
{
"$ref": "#/components/schemas/EnvironmentRef"
}
],
"nullable": true
},
"__meta": {
"type": "array",
"items": {
@ -148519,28 +148451,6 @@
}
}
},
"EnvironmentRef": {
"description": "An index pointing to an environment at a point in time (either a snapshot or the current version, see the module docs).",
"type": "array",
"items": [
{
"type": "integer",
"format": "uint",
"minimum": 0.0
},
{
"$ref": "#/components/schemas/SnapshotRef"
}
],
"maxItems": 2,
"minItems": 2
},
"SnapshotRef": {
"description": "An index pointing to a snapshot within a specific (unspecified) environment.",
"type": "integer",
"format": "uint",
"minimum": 0.0
},
"ModuleId": {
"description": "Identifier of a source file. Uses a u32 to keep the size small.",
"type": "integer",
@ -200824,10 +200734,10 @@
},
{
"name": "transform",
"type": "FunctionParam",
"type": "FunctionSource",
"schema": {
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
"title": "FunctionParam",
"title": "FunctionSource",
"type": "null",
"definitions": {
"ArtifactId": {
@ -208949,10 +208859,10 @@
},
{
"name": "transform",
"type": "FunctionParam",
"type": "FunctionSource",
"schema": {
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
"title": "FunctionParam",
"title": "FunctionSource",
"type": "null",
"definitions": {
"Path": {
@ -219594,14 +219504,6 @@
"Function"
]
},
"memory": {
"allOf": [
{
"$ref": "#/components/schemas/EnvironmentRef"
}
],
"nullable": true
},
"__meta": {
"type": "array",
"items": {
@ -221735,28 +221637,6 @@
}
}
},
"EnvironmentRef": {
"description": "An index pointing to an environment at a point in time (either a snapshot or the current version, see the module docs).",
"type": "array",
"items": [
{
"type": "integer",
"format": "uint",
"minimum": 0.0
},
{
"$ref": "#/components/schemas/SnapshotRef"
}
],
"maxItems": 2,
"minItems": 2
},
"SnapshotRef": {
"description": "An index pointing to a snapshot within a specific (unspecified) environment.",
"type": "integer",
"format": "uint",
"minimum": 0.0
},
"ModuleId": {
"description": "Identifier of a source file. Uses a u32 to keep the size small.",
"type": "integer",
@ -222211,14 +222091,6 @@
"Function"
]
},
"memory": {
"allOf": [
{
"$ref": "#/components/schemas/EnvironmentRef"
}
],
"nullable": true
},
"__meta": {
"type": "array",
"items": {
@ -223102,14 +222974,6 @@
"Function"
]
},
"memory": {
"allOf": [
{
"$ref": "#/components/schemas/EnvironmentRef"
}
],
"nullable": true
},
"__meta": {
"type": "array",
"items": {
@ -224863,28 +224727,6 @@
}
}
},
"EnvironmentRef": {
"description": "An index pointing to an environment at a point in time (either a snapshot or the current version, see the module docs).",
"type": "array",
"items": [
{
"type": "integer",
"format": "uint",
"minimum": 0.0
},
{
"$ref": "#/components/schemas/SnapshotRef"
}
],
"maxItems": 2,
"minItems": 2
},
"SnapshotRef": {
"description": "An index pointing to a snapshot within a specific (unspecified) environment.",
"type": "integer",
"format": "uint",
"minimum": 0.0
},
"ModuleId": {
"description": "Identifier of a source file. Uses a u32 to keep the size small.",
"type": "integer",
@ -230504,14 +230346,6 @@
"Function"
]
},
"memory": {
"allOf": [
{
"$ref": "#/components/schemas/EnvironmentRef"
}
],
"nullable": true
},
"__meta": {
"type": "array",
"items": {
@ -232645,28 +232479,6 @@
}
}
},
"EnvironmentRef": {
"description": "An index pointing to an environment at a point in time (either a snapshot or the current version, see the module docs).",
"type": "array",
"items": [
{
"type": "integer",
"format": "uint",
"minimum": 0.0
},
{
"$ref": "#/components/schemas/SnapshotRef"
}
],
"maxItems": 2,
"minItems": 2
},
"SnapshotRef": {
"description": "An index pointing to a snapshot within a specific (unspecified) environment.",
"type": "integer",
"format": "uint",
"minimum": 0.0
},
"ModuleId": {
"description": "Identifier of a source file. Uses a u32 to keep the size small.",
"type": "integer",
@ -233119,14 +232931,6 @@
"Function"
]
},
"memory": {
"allOf": [
{
"$ref": "#/components/schemas/EnvironmentRef"
}
],
"nullable": true
},
"__meta": {
"type": "array",
"items": {
@ -233630,14 +233434,6 @@
"Function"
]
},
"memory": {
"allOf": [
{
"$ref": "#/components/schemas/EnvironmentRef"
}
],
"nullable": true
},
"__meta": {
"type": "array",
"items": {
@ -235771,28 +235567,6 @@
}
}
},
"EnvironmentRef": {
"description": "An index pointing to an environment at a point in time (either a snapshot or the current version, see the module docs).",
"type": "array",
"items": [
{
"type": "integer",
"format": "uint",
"minimum": 0.0
},
{
"$ref": "#/components/schemas/SnapshotRef"
}
],
"maxItems": 2,
"minItems": 2
},
"SnapshotRef": {
"description": "An index pointing to a snapshot within a specific (unspecified) environment.",
"type": "integer",
"format": "uint",
"minimum": 0.0
},
"ModuleId": {
"description": "Identifier of a source file. Uses a u32 to keep the size small.",
"type": "integer",
@ -236246,14 +236020,6 @@
"Function"
]
},
"memory": {
"allOf": [
{
"$ref": "#/components/schemas/EnvironmentRef"
}
],
"nullable": true
},
"__meta": {
"type": "array",
"items": {
@ -237137,14 +236903,6 @@
"Function"
]
},
"memory": {
"allOf": [
{
"$ref": "#/components/schemas/EnvironmentRef"
}
],
"nullable": true
},
"__meta": {
"type": "array",
"items": {
@ -238898,28 +238656,6 @@
}
}
},
"EnvironmentRef": {
"description": "An index pointing to an environment at a point in time (either a snapshot or the current version, see the module docs).",
"type": "array",
"items": [
{
"type": "integer",
"format": "uint",
"minimum": 0.0
},
{
"$ref": "#/components/schemas/SnapshotRef"
}
],
"maxItems": 2,
"minItems": 2
},
"SnapshotRef": {
"description": "An index pointing to a snapshot within a specific (unspecified) environment.",
"type": "integer",
"format": "uint",
"minimum": 0.0
},
"ModuleId": {
"description": "Identifier of a source file. Uses a u32 to keep the size small.",
"type": "integer",
@ -239391,14 +239127,6 @@
"Function"
]
},
"memory": {
"allOf": [
{
"$ref": "#/components/schemas/EnvironmentRef"
}
],
"nullable": true
},
"__meta": {
"type": "array",
"items": {
@ -241532,28 +241260,6 @@
}
}
},
"EnvironmentRef": {
"description": "An index pointing to an environment at a point in time (either a snapshot or the current version, see the module docs).",
"type": "array",
"items": [
{
"type": "integer",
"format": "uint",
"minimum": 0.0
},
{
"$ref": "#/components/schemas/SnapshotRef"
}
],
"maxItems": 2,
"minItems": 2
},
"SnapshotRef": {
"description": "An index pointing to a snapshot within a specific (unspecified) environment.",
"type": "integer",
"format": "uint",
"minimum": 0.0
},
"ModuleId": {
"description": "Identifier of a source file. Uses a u32 to keep the size small.",
"type": "integer",
@ -242006,14 +241712,6 @@
"Function"
]
},
"memory": {
"allOf": [
{
"$ref": "#/components/schemas/EnvironmentRef"
}
],
"nullable": true
},
"__meta": {
"type": "array",
"items": {
@ -242517,14 +242215,6 @@
"Function"
]
},
"memory": {
"allOf": [
{
"$ref": "#/components/schemas/EnvironmentRef"
}
],
"nullable": true
},
"__meta": {
"type": "array",
"items": {
@ -244658,28 +244348,6 @@
}
}
},
"EnvironmentRef": {
"description": "An index pointing to an environment at a point in time (either a snapshot or the current version, see the module docs).",
"type": "array",
"items": [
{
"type": "integer",
"format": "uint",
"minimum": 0.0
},
{
"$ref": "#/components/schemas/SnapshotRef"
}
],
"maxItems": 2,
"minItems": 2
},
"SnapshotRef": {
"description": "An index pointing to a snapshot within a specific (unspecified) environment.",
"type": "integer",
"format": "uint",
"minimum": 0.0
},
"ModuleId": {
"description": "Identifier of a source file. Uses a u32 to keep the size small.",
"type": "integer",
@ -244711,10 +244379,10 @@
},
{
"name": "reduce_fn",
"type": "FunctionParam",
"type": "FunctionSource",
"schema": {
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
"title": "FunctionParam",
"title": "FunctionSource",
"type": "null",
"definitions": {
"KclValue": {
@ -245135,14 +244803,6 @@
"Function"
]
},
"memory": {
"allOf": [
{
"$ref": "#/components/schemas/EnvironmentRef"
}
],
"nullable": true
},
"__meta": {
"type": "array",
"items": {
@ -247276,28 +246936,6 @@
}
}
},
"EnvironmentRef": {
"description": "An index pointing to an environment at a point in time (either a snapshot or the current version, see the module docs).",
"type": "array",
"items": [
{
"type": "integer",
"format": "uint",
"minimum": 0.0
},
{
"$ref": "#/components/schemas/SnapshotRef"
}
],
"maxItems": 2,
"minItems": 2
},
"SnapshotRef": {
"description": "An index pointing to a snapshot within a specific (unspecified) environment.",
"type": "integer",
"format": "uint",
"minimum": 0.0
},
"ModuleId": {
"description": "Identifier of a source file. Uses a u32 to keep the size small.",
"type": "integer",
@ -247751,14 +247389,6 @@
"Function"
]
},
"memory": {
"allOf": [
{
"$ref": "#/components/schemas/EnvironmentRef"
}
],
"nullable": true
},
"__meta": {
"type": "array",
"items": {
@ -248642,14 +248272,6 @@
"Function"
]
},
"memory": {
"allOf": [
{
"$ref": "#/components/schemas/EnvironmentRef"
}
],
"nullable": true
},
"__meta": {
"type": "array",
"items": {
@ -250403,28 +250025,6 @@
}
}
},
"EnvironmentRef": {
"description": "An index pointing to an environment at a point in time (either a snapshot or the current version, see the module docs).",
"type": "array",
"items": [
{
"type": "integer",
"format": "uint",
"minimum": 0.0
},
{
"$ref": "#/components/schemas/SnapshotRef"
}
],
"maxItems": 2,
"minItems": 2
},
"SnapshotRef": {
"description": "An index pointing to a snapshot within a specific (unspecified) environment.",
"type": "integer",
"format": "uint",
"minimum": 0.0
},
"ModuleId": {
"description": "Identifier of a source file. Uses a u32 to keep the size small.",
"type": "integer",

View File

@ -295,7 +295,6 @@ Data for an imported geometry.
| Property | Type | Description | Required |
|----------|------|-------------|----------|
| `type` |enum: `Function`| | No |
| `memory` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
| `__meta` |`[` [`Metadata`](/docs/kcl/types/Metadata) `]`| | No |